Skip to content

Add unit tests to increase coverage#494

Open
vissarion wants to merge 2 commits into
GeomScale:developfrom
vissarion:add_unit_tests
Open

Add unit tests to increase coverage#494
vissarion wants to merge 2 commits into
GeomScale:developfrom
vissarion:add_unit_tests

Conversation

@vissarion

Copy link
Copy Markdown
Member

Add 7 new test files with 130+ test cases covering previously untested code:

  • poset_misc_test.cpp: Poset class (verify, constructor, is_in, topology sort) and misc.h utilities (read_pointset, read_objective, read_poset_from_file)
  • generators_test.cpp: All known polytope generators (cube, cross, simplex, prod_simplex, skinny_cube, birkhoff) in H and V representations
  • convex_body_test.cpp: ConvexBody class and unit ball generators
  • zonotope_gen_test.cpp: Random zonotope generators (gaussian, uniform, exponential)
  • small_utils_test.cpp: Combined tests for known generators and convex body
  • print_table_test.cpp: VariadicTable printing utility
  • sdpa_format_test.cpp: SDPA file format read/write/roundtrip

Add coverage job to cmake-gcc workflow (lcov-based, runs on PRs).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.txt via new add_executable()/add_test() entries.
  • Added a new lcov-based “Coverage (gcc)” job to the cmake-gcc GitHub 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.

Comment thread test/CMakeLists.txt Outdated
Comment thread test/CMakeLists.txt Outdated
Comment thread test/CMakeLists.txt Outdated
Comment thread test/print_table_test.cpp Outdated
Comment thread test/sdpa_format_test.cpp
Comment thread test/sdpa_format_test.cpp
Comment thread test/sdpa_format_test.cpp
Comment thread test/sdpa_format_test.cpp
Comment thread .github/workflows/cmake-gcc.yml Outdated
Comment thread .github/workflows/cmake-gcc.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Comment thread .github/workflows/cmake-gcc.yml Outdated
Comment thread .github/workflows/cmake-gcc.yml Outdated
Comment thread test/CMakeLists.txt Outdated
Comment thread test/convex_body_test.cpp
Comment thread test/zonotope_gen_test.cpp
Comment thread test/sdpa_format_test.cpp
@vissarion vissarion force-pushed the add_unit_tests branch 22 times, most recently from e2d3144 to b9cdb33 Compare June 30, 2026 21:57
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 6.35%. Comparing base (32e3421) to head (d420471).
⚠️ Report is 31 commits behind head on develop.

❗ There is a different number of reports uploaded between BASE (32e3421) and HEAD (d420471). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (32e3421) HEAD (d420471)
1 0
Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
unittests 6.35% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 113 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… 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>
@vissarion vissarion force-pushed the add_unit_tests branch 3 times, most recently from f6d59bf to 7aadd6c Compare July 2, 2026 09:26
@vissarion vissarion changed the title Add unit tests for to increase coverage Add unit tests to increase coverage Jul 2, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants