Daily Test Coverage Improver: Add comprehensive API special relations tests #7925
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive test coverage for Z3's special relations API functions, achieving 100% coverage for the
src/api/api_special_relations.cppmodule, which previously had 0% test coverage.Problem Found
The special relations API functions had zero test coverage despite being important functionality for creating mathematical order relations:
src/api/api_special_relations.cpp: 0% coverage (0/5 lines covered)Actions Taken
src/test/api_special_relations.cppsrc/test/main.cppandsrc/test/CMakeLists.txtZ3_mk_linear_order- Create linear order relations with specified indicesZ3_mk_partial_order- Create partial order relationsZ3_mk_piecewise_linear_order- Create piecewise linear order relationsZ3_mk_tree_order- Create tree order relationsZ3_mk_transitive_closure- Create transitive closure of binary relationsTest Coverage Results
Before:
src/api/api_special_relations.cpp: 0% coverage (0/5 lines)After:
src/api/api_special_relations.cpp: 100% coverage (5/5 lines) - +5 lines coveredCoverage improvement achieved: Complete coverage of all special relations API functions with comprehensive testing of functionality and integration.
Replicating the Test Coverage Measurements
Build and run the new test:
Expected Output:
Commands to install dependencies, build, run tests, and generate coverage reports:
Future Improvement Areas
Based on remaining high-impact areas with 0% coverage for other API modules:
src/api/api_fpa.cpp(0% coverage, 1090 lines) - Floating-point arithmetic APIsrc/api/api_commands.cpp(0% coverage, 5687 lines) - Command interface functionsOther areas with partial coverage that could be improved:
src/api/api_model.cpp(30% coverage, 330 lines) - Model manipulation functionssrc/api/api_numeral.cpp(20% coverage, 329 lines) - Numeral conversion functionssrc/api/api_goal.cpp(50% coverage, 150 lines) - Goal manipulation functionsWorkflow Details
Bash Commands Run
git checkout -b daily-test-improver-api-special-relations-testsninja test-z3./test-z3 api_special_relationsgcovr --merge-mode-functions=separate --gcov-ignore-parse-errors --gcov-executable "llvm-cov gcov" --filter ".*api_special_relations.*" .git add ../src/test/api_special_relations.cpp ../src/test/main.cpp ../src/test/CMakeLists.txtgit commit --author "Daily Test Coverage Improver <github-actions[bot]@users.noreply.github.com>" -m "..."Web Searches Performed
None
Web Pages Fetched
None