Daily Test Coverage Improver: Add comprehensive API AST map tests#7890
Merged
NikolajBjorner merged 6 commits intomasterfrom Sep 17, 2025
Merged
Conversation
Improved test coverage from 0% to 84% for src/api/api_ast_map.cpp by adding comprehensive tests for: - Basic map operations (creation, insertion, lookup, size) - Map manipulation (overwrite values, erase entries, reset) - Reference counting (inc_ref/dec_ref) - String representation (to_string function) This contributes 94 newly covered lines to overall project test coverage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 AST map API functions, significantly improving test coverage from 0% to 84% for the
src/api/api_ast_map.cppmodule.Problem Found
The AST map API functions (
Z3_ast_map_*) had zero test coverage despite being a core part of Z3's AST manipulation capabilities:src/api/api_ast_map.cpp: 0% coverage (0/111 lines covered)Actions Taken
src/test/api_ast_map.cppsrc/test/main.cppandsrc/test/CMakeLists.txtZ3_mk_ast_map,Z3_ast_map_insert,Z3_ast_map_find,Z3_ast_map_contains,Z3_ast_map_sizeZ3_ast_map_erase,Z3_ast_map_resetZ3_ast_map_inc_ref,Z3_ast_map_dec_refZ3_ast_map_to_stringChanges in Test Coverage Achieved
Before:
src/api/api_ast_map.cpp: 0% coverage (0/111 lines)After:
src/api/api_ast_map.cpp: 84% coverage (94/111 lines) - +94 lines coveredCoverage improvement breakdown:
Validation Commands
To validate the coverage improvements:
Future Improvement Areas
Based on remaining uncovered areas in
api_ast_map.cpp:Other high-impact areas for future coverage improvements:
src/api/api_datalog.cpp(0% coverage, 486 lines) - Datalog API functionssrc/api/api_fpa.cpp(0% coverage, 1090 lines) - Floating-point arithmetic APIsrc/api/api_pb.cpp(0% coverage, 64 lines) - Pseudo-boolean API functions<details>
<summary>Workflow Details</summary>
Bash Commands Run
git checkout -b daily-test-improver-api-ast-map-testsninja -C build test-z3./build/test-z3 api_ast_mapgcovr --merge-mode-functions=separate --gcov-ignore-parse-errors --gcov-executable "llvm-cov gcov" . | grep api_ast_mapgit add src/test/api_ast_map.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
</details>
> AI-generated content by Daily Test Coverage Improver may contain mistakes.