-
Notifications
You must be signed in to change notification settings - Fork 12
Add tests for case expressions #179
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
Add tests for case expressions #179
Conversation
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.
Please add the function indirection I mentioned before merging
testsuite/gnat2goto/tests/case_expression_others/case_expression_others.adb
Outdated
Show resolved
Hide resolved
@@ -0,0 +1 @@ | |||
ALL XFAIL CBMC crashes with first argument of if must be boolean, but got or |
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.
can you squash this together with the commit fixing this so you can remove it?
begin | ||
Result := (case Random_Val is | ||
when 1..10 => 1, | ||
when 11..20 => 2, |
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.
I suspect handling a range expression should be fairly easy - a literal range should always be translatable like this x in a..b ===> a <= x and x <= b
I'd think
to avoid constant folding.
During the work performed for case statement support in gnat2goto (#171) it was discovered that we do support case expressions already, but it's not a documented nor tested feature. This adds some basic tests for this, and fixes any problems discovered.