8000 OptionCategory: Add missing implementations, uncovered tests. by aniemetz · Pull Request #12011 · cvc5/cvc5 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

OptionCategory: Add missing implementations, uncovered tests. #12011

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 2 commits into from
Jun 25, 2025

Conversation

aniemetz
Copy link
Member

Enum OptionCategory was introduced in #11931, which did not include implementations for std::to_string(cvc5::modes::OptionCategory) and cvc5_modes_option_category_to_str(Cvc5OptionCategory).

This adds implementations for these functions and further adds uncovered tests for C, Python and Java (fixes coverage build in nightlies).

Enum OptionCategory was introduced in cvc5#11931, which did not include
implementations for `std::to_string(cvc5::modes::OptionCategory)`
and `cvc5_modes_option_category_to_str(Cvc5OptionCategory)`.

This adds implementations for these functions and further adds uncovered
tests for C, Python and Java (fixes coverage build in nightlies).
Copy link
Contributor
@daniel-larraz daniel-larraz left a comment

Choose a reason for hiding this comment

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

I left a couple of comments. Apart from that, shouldn't some files in docs/api/c/ be updated to document the new Cvc5OptionCategory enum?

Shouldn't the Python and Java OptionInfo classes be updated to include the new category field?

Comment on lines +89 to +96
for (int32_t c = static_cast<int32_t>(CVC5_OPTION_CATEGORY_REGULAR);
c < static_cast<int32_t>(CVC5_OPTION_CATEGORY_LAST);
++c)
{
std::string str = cvc5_modes_option_category_to_string(
static_cast<Cvc5OptionCategory>(c));
ASSERT_NE(str, "?");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand this is an easy way to test that the function "works" for all the values, and it's also future-proof in the sense that it doesn't require updating if more enum values are added later. However, it would be more robust to print all enum values as a string and check against an expected string with ASSERT_EQ, as we do for the other enum types. Please consider this option.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't test for all enum values but just a single value for other enums. I don't have a particular preference. We could actually refactor the tests for the other enums in modes to the same. Note that in the uncovered test we test for a single specific enum value.

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right, it's a single value for the other enums. I suppose my point was that testing for "not equal to ?" is a weaker check than explicitly verifying equality with an expected value. That’s the part I didn't really like. On the other hand, I liked that you tested all possible values. Since this isn't a critical issue, we can think it over a bit more and handle the refactor later.

@aniemetz
8000 Copy link
Member Author

Apart from that, shouldn't some files in docs/api/c/ be updated to document the new Cvc5OptionCategory enum?

Right, I'd rather do this in an extra PR.

Shouldn't the Python and Java OptionInfo classes be updated to include the new category field?

Right, @netolcc06 is supposed to take care of this.

@daniel-larraz daniel-larraz added this pull request to the merge queue Jun 25, 2025
Merged via the queue into cvc5:main with commit b3f4de3 Jun 25, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Priority simple Complexity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0