Add unit tests to increase coverage#494
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds several new doctest-based C++ unit test executables to increase coverage across generators, convex bodies, poset/misc utilities, SDPA format IO, and a table-printing utility, and introduces a GCC-based coverage job in CI.
Changes:
- Added new unit test source files covering zonotope/polytope generators, ConvexBody behavior, Poset + misc parsing utilities, SDPA read/write roundtrips, and VariadicTable output.
- Wired the new tests into
test/CMakeLists.txtvia newadd_executable()/add_test()entries. - Added a new lcov-based “Coverage (gcc)” job to the
cmake-gccGitHub Actions workflow.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
test/zonotope_gen_test.cpp |
Adds basic checks for random zonotope generators and seed reproducibility. |
test/small_utils_test.cpp |
Adds compact tests for known generators, convex body generators, and an extra poset scenario. |
test/sdpa_format_test.cpp |
Adds SDPA read/write and roundtrip tests, including comment-lines and block-structure cases. |
test/print_table_test.cpp |
Adds output-based tests for VariadicTable formatting options. |
test/poset_misc_test.cpp |
Adds extensive unit tests for Poset plus misc parsing helpers (read_*). |
test/generators_test.cpp |
Adds broader coverage for known polytope generators and basic geometric assertions. |
test/convex_body_test.cpp |
Adds behavior tests for unit ball generators and intersection/search helpers. |
test/CMakeLists.txt |
Registers new test executables and ctest entries for the added test files. |
.github/workflows/cmake-gcc.yml |
Adds a new coverage job intended to run on PRs using lcov. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e9f18c2 to
fe8ca52
Compare
e2d3144 to
b9cdb33
Compare
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## develop #494 +/- ##
===========================================
- Coverage 57.28% 6.35% -50.93%
===========================================
Files 114 116 +2
Lines 7241 7392 +151
Branches 3239 3468 +229
===========================================
- Hits 4148 470 -3678
- Misses 976 6555 +5579
+ Partials 2117 367 -1750
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
… sdpa Add 7 new test files with 130+ test cases covering previously untested code: - poset_misc_test.cpp: Poset class and misc.h utilities - generators_test.cpp: All known polytope generators - convex_body_test.cpp: ConvexBody class and unit ball generators - zonotope_gen_test.cpp: Random zonotope generators - small_utils_test.cpp: Combined generators and convex body tests - print_table_test.cpp: VariadicTable printing utility - sdpa_format_test.cpp: SDPA file format read/write/roundtrip Add coverage job with gcovr + codecov upload to cmake-gcc workflow. Add codecov.yml for path fixing. Add actions/cache for external dependencies across all C++ CI workflows. Co-Authored-By: Claude <noreply@anthropic.com>
f6d59bf to
7aadd6c
Compare
Move 42 test files from flat test/ into subdirectories: - convex_bodies/ (hpolytope, vpolytope, orderpolytope, convex_body) - convex_bodies/correlation_matrices/ (matrix sampling) - convex_bodies/spectrahedra/ (SDPA format) - diagnostics/ (MCMC diagnostics) - generators/ (polytope + zonotope generators) - integration/ (Monte Carlo integration) - lp_oracles/ (boundary oracles) - misc/ (poset, print_table, small_utils) - ode_solvers/ (ODE solvers, leapfrog) - preprocess/ (rounding, full_dimensional, inner points, max ellipsoid) - preprocess/crhmc/ (CRHMC preprocessing) - random_walks/ (sampling, shake-and-bake, logconcave) - random_walks/crhmc/ (CRHMC sampling) - root_finders/ (root finders) - sampling/ (MMCS) - volume/ (cooling balls, cooling gaussians, sequence of balls) - benchmarks/ (performance benchmarks) Each subdirectory has its own CMakeLists.txt with test registration. Root CMakeLists.txt retains shared setup (dependencies, coverage_config) and uses add_subdirectory() for each module. Co-Authored-By: Claude <noreply@anthropic.com>
Add 7 new test files with 130+ test cases covering previously untested code:
Add coverage job to cmake-gcc workflow (lcov-based, runs on PRs).