-
Notifications
You must be signed in to change notification settings - Fork 273
Unit tests for simplifying boolean and cast expressions #5229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
unit/util/simplify_expr.cpp
Outdated
} | ||
SECTION("Nested boolean expressions") | ||
{ | ||
INFO("((!true) || true) && (false => false))") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INFO("((!true) || true) && (false => false))") | |
INFO("((!true) || (false => false)) && true)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙇♂️
unit/util/simplify_expr.cpp
Outdated
{ | ||
struct test_entryt | ||
{ | ||
irep_idt comparision; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
irep_idt comparision; | |
irep_idt comparison; |
unit/util/simplify_expr.cpp
Outdated
const auto binary_relation_from = [](const test_entryt &entry) { | ||
const signedbv_typet int_type(32); | ||
return binary_relation_exprt{from_integer(entry.lhs, int_type), | ||
entry.comparision, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entry.comparision, | |
entry.comparison, |
unit/util/simplify_expr.cpp
Outdated
symbol_tablet symbol_table; | ||
namespacet ns(symbol_table); | ||
const auto int_type = signedbv_typet(32); | ||
const auto long_type = signedbv_typet(32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional that int
and long
are of the same width?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except that I'm not sure if casting to a smaller type should be simplified.
281a155
to
a8c1571
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tidying up old commits.
Restarted one CI job - looks spurious (apt get failure) |
Added some new unit tests to check simplification of boolean formula (so function can be used as basis for testing #5200) Also imported and updated the tests I wrote in #1075.
@tautschnig I notice in #1075 you seemed to say the following shouldn't be simplified:It was because I'd left long type as the same as int type, so was redundant. Now that's corrected, the tests behave as expected: