Files
ConformalLabpp/doc/api/tests.md
Tarik Moussa 88a99d8bd1
All checks were successful
C++ Tests / test-fast (push) Successful in 1m59s
C++ Tests / test-cgal (push) Has been skipped
fix: correct 16 inconsistencies found by consistency audit
Math / code:
- layout.hpp: add explanatory comment for Möbius deck transformation
  (from_three with z1=w1, z2=w2 encodes T fixing cut-edge endpoints)
- layout.hpp: document spherical holonomy limitation — Vector2d stores
  only (x,y) of 3-D position diff; full SO(3) representation deferred

Gradient sign convention (CLAUDE.md was wrong):
- Euclidean and Spherical both use G_v = Θ_v − actual (target minus actual)
- HyperIdeal uses G_v = actual − Θ_v
- Hessian sign differs: Euclidean PSD, Spherical NSD → −H, HyperIdeal PSD

Test counts (were inconsistent across all files):
- Actual: 176 CGAL tests, 2 GTEST_SKIP (not 173/170/174, not 1 skip)
- The 2 skips are EuclideanFunctional + SphericalFunctional Hessian gradient
  checks (Java @Ignore ports) — not HyperIdeal Hessian as previously stated
- doc/api/tests.md: add missing SmokeEuclidean suite (3 tests),
  EuclideanLayout (2), SphericalLayout (1), fix GaussBonnet 8→12,
  MeshIO 9→6, Layout 8→6, EuclideanFunctional 11→12,
  HomologyGenerators no longer a GTEST_SKIP stub (live test on brezel2.obj)
- doc/roadmap/phases.md: Phase 7 cumulative 158→176 tests
- doc/roadmap/phases.md: Phase 3 clarified — HyperIdeal Hessian is FD
- CLAUDE.md: suite count 28→34, test ref 173+36→174+36
- scripts/try_it.sh: expected output 173/1 skipped → 174/2 skipped

CI table (CLAUDE.md):
- test-cgal now triggers on pull requests only (not main/dev pushes)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 23:24:44 +02:00

85 lines
5.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Test Suites
## `conformallab_tests` — always built (no CGAL)
Pure-math tests, only Eigen required. Covers Java utilities ported in Phase 12.
| File | What it tests |
|---|---|
| `test_clausen.cpp` | Clausen Cl₂, Lobachevsky Л, ImLi₂ — values at known points |
| `test_hyper_ideal_utility.cpp` | Tetrahedron volumes (Meyerhoff / KolpakovMednykh) |
| `test_matrix_utility.cpp` | Matrix helpers |
| `test_surface_curve_utility.cpp` | Surface curve utilities |
| `test_discrete_elliptic_utility.cpp` | Discrete elliptic functions |
| `test_p2_utility.cpp` | P2 projective utilities |
| `test_hyper_ideal_visualization_utility.cpp` | Poincaré disk projection, circumcircle |
**Total: 36 tests, 0 skipped.**
---
## `conformallab_cgal_tests` — built with `-DWITH_CGAL_TESTS=ON` or `-DWITH_CGAL=ON`
All tests have CTest prefix `cgal.` (set via `TEST_PREFIX "cgal."` in CMakeLists).
| Suite | File | Tests | What is verified |
|---|---|---:|---|
| `ConformalMeshTopology` | `test_conformal_mesh.cpp` | 4 | Euler characteristic, vertex/edge/face counts |
| `ConformalMeshTraversal` | `test_conformal_mesh.cpp` | 4 | Halfedge iteration, valence, opposite |
| `ConformalMeshProperties` | `test_conformal_mesh.cpp` | 5 | Property maps (λ, θ, idx, α, geometry type) |
| `ConformalMeshValidity` | `test_conformal_mesh.cpp` | 1 | CGAL validity for all factory meshes |
| `HyperIdealFunctional` | `test_hyper_ideal_functional.cpp` | 7 | FD gradient checks + Hessian symmetry |
| `SphericalFunctional` | `test_spherical_functional.cpp` | 12 | Angle formula + gradient + gauge-fix *(1 skipped)* |
| `EuclideanFunctional` | `test_euclidean_functional.cpp` | 12 | Angle formula + gradient *(1 skipped)* |
| `EuclideanHessian` | `test_euclidean_hessian.cpp` | 9 | Cotangent Laplacian structure, FD agreement, PSD, null space |
| `SphericalHessian` | `test_spherical_hessian.cpp` | 8 | Derivative correctness, NSD at equilibrium |
| `NewtonSolver` | `test_newton_solver.cpp` | 11 | Convergence: Euclidean ×3, Spherical ×4, HyperIdeal ×4 |
| `SparseQRFallback` | `test_newton_solver.cpp` | 3 | Full-rank LDLT · singular matrix → QR · closed mesh gauge mode |
| `MeshIO` | `test_mesh_io.cpp` | 6 | OFF/OBJ round-trips, error handling |
| `Pipeline` | `test_pipeline.cpp` | 5 | End-to-end: build → setup → solve → export → reload |
| `Layout` | `test_layout.cpp` | 6 | Edge-length preservation (Eucl./Spher.), Poincaré disk layout |
| `Serialization` | `test_layout.cpp` | 2 | JSON and XML round-trips (DOF vector + layout UVs) |
| `GaussBonnet` | `test_phase6.cpp` | 12 | χ, genus, sum/RHS, deficit, check, enforce |
| `CutGraph` | `test_phase6.cpp` | 6 | Tree-cotree, open/closed meshes, flagindex consistency |
| `HyperbolicTrilateration` | `test_phase6.cpp` | 4 | Möbius + law of cosines: exact distances, disk interior, off-origin |
| `Normalisation` | `test_phase6.cpp` | 4 | Euclidean centroid, length ratios, Möbius centring |
| `MobiusMap` | `test_phase7.cpp` | 8 | Identity, inverse, compose, `from_three`, `apply(Vector2d)` |
| `BestRootFace` | `test_phase7.cpp` | 2 | Valid root face selection, interior bonus |
| `HalfedgeUV` | `test_phase7.cpp` | 4 | Size = #halfedges, seam consistency, boundary halfedges = 0 |
| `PriorityBFS` | `test_phase7.cpp` | 3 | Success, no seam on open meshes, all vertices placed |
| `NormaliseEuclidean` | `test_phase7.cpp` | 2 | UV centroid = 0, halfedge_uv centroid = 0 |
| `PeriodMatrix` | `test_phase7.cpp` | 7 | τ ∈ , SL(2,) reduction, exception outside |
| `FundamentalDomain` | `test_phase7.cpp` | 7 | Genus-1 parallelogram CCW, generators, g > 1 empty |
| `TilingCopy/Neighbourhood` | `test_phase7.cpp` | 4 | Translation correct, tile count |
| `CuttingUtility` | `test_geometry_utils.cpp` | 3 | `point_in_triangle_2d`: false, true, unit triangle (Java CuttingUtilityTest) |
| `UnwrapUtility` | `test_geometry_utils.cpp` | 2 | Corner angle: collinear → π, equilateral → π/3 (Java UnwrapUtilityTest) |
| `ConvergenceUtility` | `test_geometry_utils.cpp` | 6 | Circumradius + scale-invariant R_f/√A (Java ConvergenceUtilityTests) |
| `EuclideanLayout` | `test_geometry_utils.cpp` | 2 | Euclidean layout round-trip edge lengths |
| `SphericalLayout` | `test_geometry_utils.cpp` | 1 | Spherical layout on unit sphere |
| `HomologyGenerators` | `test_geometry_utils.cpp` | 1 | Genus-2 cut graph: χ = 2, 4 cut edges (`brezel2.obj`) |
| `SmokeEuclidean` | `test_scalability_smoke.cpp` | 3 | Smoke tests on real meshes: CatHead (open), Brezel genus-1, Brezel2 genus-2 |
**Total: 176 tests, 2 intentional skips.**
The 2 skips are Java `@Ignore` ports — stubs until the analytic Hessian gradient checks are implemented (Phase 9b):
- `SphericalFunctional.GradientCheck_Hessian`
- `EuclideanFunctional.GradientCheck_Hessian`
---
## Running tests
```bash
# All CGAL tests
ctest --test-dir build -R "^cgal\." --output-on-failure
# One suite
./build/conformallab_cgal_tests --gtest_filter="PeriodMatrix*"
# One specific test
./build/conformallab_cgal_tests --gtest_filter="PeriodMatrix.TauInUpperHalfPlane"
# Verbose output with timing
./build/conformallab_cgal_tests --gtest_filter="NewtonSolver*" --gtest_print_time=1
```