Skip to content

implement boolbvt::get for enumeration types #8589

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

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Conversation

kroening
Copy link
Member

This adds the missing implementation for getting values from models for enumeration types.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

else if(type.id() == ID_enumeration)
{
auto &elements = to_enumeration_type(type).elements();
mp_integer int_value = binary2integer(value, false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Can this be negative?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, binary2integer(..., false) won't return a negative value.

mp_integer int_value = binary2integer(value, false);
irep_idt element;
if(int_value >= elements.size())
element = irep_idt{};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Where will we fall over when encountering this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning nil instead.

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

Attention: Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.59%. Comparing base (66004dc) to head (b4f9748).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/solvers/flattening/boolbv_get.cpp 77.77% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8589      +/-   ##
===========================================
+ Coverage    78.71%   79.59%   +0.88%     
===========================================
  Files         1732     1733       +1     
  Lines       199536   197389    -2147     
  Branches     18281    18166     -115     
===========================================
+ Hits        157057   157111      +54     
+ Misses       42479    40278    -2201     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This adds the missing implementation for getting values from models for
enumeration types.
@kroening kroening enabled auto-merge February 10, 2025 19:54
@kroening kroening merged commit 6957a04 into develop Feb 10, 2025
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants