Unit tests for ported datagen modules #6

Closed
opened 2026-02-02 19:32:57 +00:00 by forbes · 0 comments
Owner

Summary

Write unit tests for all modules ported in #1-#5. Reuse the demo scenarios from the original pebble-game.py as test fixtures per the repository plan.

Test files

  • tests/datagen/test_types.py — construction, serialization, enum values
  • tests/datagen/test_pebble_game.py — pebble game algorithm correctness
  • tests/datagen/test_jacobian.py — Jacobian construction and rank computation
  • tests/datagen/test_analysis.py — combined analysis function
  • tests/datagen/test_generator.py — synthetic assembly generation

Test scenarios (from demo, L1283-1442)

  1. Two bodies + revolute joint: expect 1 internal DOF, underconstrained
  2. Two bodies + fixed joint: expect 0 internal DOF, rigid, minimally rigid
  3. Triangle of 3 bodies + 3 revolute joints: overconstrained (15 constraints, 12 needed)
  4. Parallel revolute axes: geometric degeneracy detection (pebble game says independent, Jacobian disagrees)
  5. Synthetic batch generation: verify batch output structure, classification distribution

Additional tests

  • Each JointType enum has correct DOF value
  • PebbleGame3D: single body has 6 free pebbles, adding bodies is idempotent
  • PebbleGame3D: all joint types expand to correct number of multigraph edges
  • JacobianVerifier: each joint builder produces correct number of rows
  • JacobianVerifier: Jacobian shape is (n_constraints, 6*n_bodies)
  • JacobianVerifier: find_dependencies() returns subset of row indices
  • analyze_assembly: grounded vs ungrounded DOF accounting
  • SyntheticAssemblyGenerator: chain is never rigid, rigid assembly is rigid, overconstrained has redundant > 0
  • Deterministic output with fixed seed

Depends on

  • #1 through #5 (all port issues)
## Summary Write unit tests for all modules ported in #1-#5. Reuse the demo scenarios from the original `pebble-game.py` as test fixtures per the repository plan. ## Test files - `tests/datagen/test_types.py` — construction, serialization, enum values - `tests/datagen/test_pebble_game.py` — pebble game algorithm correctness - `tests/datagen/test_jacobian.py` — Jacobian construction and rank computation - `tests/datagen/test_analysis.py` — combined analysis function - `tests/datagen/test_generator.py` — synthetic assembly generation ## Test scenarios (from demo, L1283-1442) 1. **Two bodies + revolute joint**: expect 1 internal DOF, underconstrained 2. **Two bodies + fixed joint**: expect 0 internal DOF, rigid, minimally rigid 3. **Triangle of 3 bodies + 3 revolute joints**: overconstrained (15 constraints, 12 needed) 4. **Parallel revolute axes**: geometric degeneracy detection (pebble game says independent, Jacobian disagrees) 5. **Synthetic batch generation**: verify batch output structure, classification distribution ## Additional tests - [ ] Each `JointType` enum has correct DOF value - [ ] `PebbleGame3D`: single body has 6 free pebbles, adding bodies is idempotent - [ ] `PebbleGame3D`: all joint types expand to correct number of multigraph edges - [ ] `JacobianVerifier`: each joint builder produces correct number of rows - [ ] `JacobianVerifier`: Jacobian shape is (n_constraints, 6*n_bodies) - [ ] `JacobianVerifier`: `find_dependencies()` returns subset of row indices - [ ] `analyze_assembly`: grounded vs ungrounded DOF accounting - [ ] `SyntheticAssemblyGenerator`: chain is never rigid, rigid assembly is rigid, overconstrained has redundant > 0 - [ ] Deterministic output with fixed seed ## Depends on - #1 through #5 (all port issues)
forbes added the phase:1testing labels 2026-02-02 19:32:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/solver#6