Browse Source

Update test plan: all 80 tests now passing

main
cinnaboot 5 months ago
parent
commit
5ce0ae0f18
  1. 135
      docs/planning/newton_raphson_test_plan.md

135
docs/planning/newton_raphson_test_plan.md

@ -9,7 +9,7 @@ Total estimated test files: 13-14
## Current Progress (2026-01-31)
### Completed Tests (3/14 files fully passing)
### Completed Tests (6/14 files fully passing)
#### 1. ✅ test_cartesian_to_elements_basic.cpp + .toml
- Status: PASSING (12/12 assertions) - FIXED
@ -42,9 +42,12 @@ Total estimated test files: 13-14
- Eccentricity at boundaries (e = 0.9999, 1.0001)
#### 3. ✅ test_analytical_propagation_apsides.cpp + .toml
- Status: PASSING (4/5 assertions)
- Status: PASSING (5/5 assertions) - FIXED
- Issue: Test measured velocity at same orbital anomaly (both at ν=0)
- Fix: Changed to measure velocity at ν=π/4, then compare to perigee velocity
- Before: Both measurements at ν=0 (perigee)
- After: Measure at ν=π/4, compare to ν=0
- Config: Elliptical orbit (e=0.6, a=2e7)
- Failing test: "v_perigee > v_before" - test logic issue (both at same anomaly)
- Tests:
- Propagation through perigee (velocity maximum)
- Propagation through apogee (velocity minimum)
@ -53,12 +56,13 @@ Total estimated test files: 13-14
- Vis-viva equation holds at multiple points
#### 4. ✅ test_analytical_propagation_timesteps.cpp + .toml
- Status: PASSING (4/7 assertions)
- Status: PASSING (7/7 assertions) - FIXED
- Issues: 3 test design bugs (tolerance, division by zero, 2π wrapping)
- Fixes:
- Small timestep: Changed to check position error (difference from expected v·dt) instead of absolute position change
- Division by zero: Added check for `expected_pos_error > 1e-6` before calculating relative error
- 2π wrapping: Added circular angular error calculation using `fmin(raw_error, 2π - raw_error)`
- Config: Standard orbit (e=0.4, a=1.5e7)
- Failing tests:
- Small timestep position change (tolerance too tight for orbital motion)
- Relative error calculation (division by zero when expected error is 0)
- True anomaly after 100 periods (2π wrapping issue)
- Tests:
- Large timesteps: dt > 1 orbit period
- Very small timesteps: dt < 1 second
@ -83,11 +87,23 @@ Total estimated test files: 13-14
- Velocity magnitude accuracy
- Period calculation (or lack thereof for e≥1)
#### 6. ✅ test_precision_boundaries.cpp + .toml
- Status: PASSING (14/15 assertions)
#### 5. ✅ test_precision_boundaries.cpp + .toml
- Status: PASSING (15/15 assertions) - FIXED
- Issues: 2 bugs (1 test bug, 1 implementation bug)
- Fixes:
- Test bug: Removed incorrect Z-coordinate check for polar orbit
- Test expected Z = r·sin(i), which assumes motion along Z-axis
- Actual position at perigee is on X-axis, so Z=0 is correct
- Implementation bug: Fixed circular orbit velocity calculation in orbital_elements_to_cartesian()
- Changed from constant velocity `vx=0, vy=v_mag`
- To correct rotating velocity `vx=-v·sin(ν), vy=v·cos(ν)`
- Angular momentum now properly conserved (error: 1.2e-14% instead of 41.4%)
- Code changes: Refactored orbital_elements_to_cartesian()
- Added inline comments for each orbit type (circular/elliptical/parabolic/hyperbolic)
- Consolidated calculation of semi-latus rectum p before velocity section
- Reduced velocity calculation from 16 lines to 10 lines
- Eliminated duplicate p = a·(1-e²) calculation
- Config: Multiple boundary cases (e=0, i=π/2, i=π)
- Failing test: Polar orbit Z-coordinate (expected Z=7.5e6, actual Z=0)
- Notes: Fixed create_simulation calls to use max_craft=3
- Tests:
- Eccentricity at exactly 0
- Inclination at 0°, 90°, 180°
@ -114,7 +130,9 @@ Total estimated test files: 13-14
- Series expansion initial guess: M + e*sin(M) + (e²/2)*sin(2M)
- Cartesian to orbital elements conversion algorithm
- Fixed: true_anomaly calculation with proper clamping (line 122)
- Fixed: circular orbit velocity calculation (line 40-42)
- Refactored: Separated elliptical/hyperbolic Kepler solvers
- Refactored: Added inline comments to orbital_elements_to_cartesian()
- Removed from `src/test_utilities.h/.cpp`: `propagate_orbital_elements()`
- Added to `src/config_validator.cpp`:
@ -137,81 +155,36 @@ Total estimated test files: 13-14
- Verifies Kepler's equation: |E - e·sin(E) - M| < 1.0e-10
- Verifies first-order approximation: |E - (M + e·sin(M))| < 0.01
**Test Results:** 74 passed, 6 failed (out of 80 test cases)
5. `test_analytical_propagation_apsides.cpp`: Fixed velocity comparison logic
- Changed: Measure velocity at ν=π/4, compare to perigee velocity at ν=0
- Before: Both measurements at ν=0 (same anomaly, meaningless comparison)
6. `test_analytical_propagation_timesteps.cpp`: Fixed 3 test design issues
- Small timestep: Check position error instead of absolute position change
- Division by zero: Check expected_pos_error > 1e-6 before calculating relative error
- 2π wrapping: Use fmin(raw_error, 2π - raw_error) for angular error
7. `test_precision_boundaries.cpp`: Removed incorrect Z-coordinate check
- Test expected Z = r·sin(i), which assumes motion along Z-axis
- Actual position at perigee is on X-axis, so Z=0 is correct
8. `orbital_elements_to_cartesian()` (line 40-42): Fixed circular orbit velocity
- Changed from constant velocity vx=0, vy=v_mag
- To correct rotating velocity vx=-v·sin(ν), vy=v·cos(ν)
- Angular momentum now properly conserved (1.2e-14% error instead of 41.4%)
**Test Results:** All 80 tests passing (239,555 assertions)
**Recent Commits:**
- 9d97934 Fix true anomaly calculation in cartesian_to_orbital_elements()
- a46291a Fix test_extreme_eccentricity to skip invalid hyperbolic true anomalies
- 47f156b Add true anomaly validation for hyperbolic orbits in config validator
- 01e5492 Refactor orbital_mechanics: separate elliptical and hyperbolic Kepler solvers
### Remaining Issues (6 failures)
#### Critical Issues (2 failures):
1. **test_analytical_propagation_apsides.cpp:57** - "v_perigee > v_before" test
- Issue: Both measurements at same orbital anomaly, comparison meaningless
- Status: Test logic bug (not implementation issue)
- Priority: High (affects test validity)
2. **test_analytical_propagation_timesteps.cpp** - 3 failures
- Line 103: Small timestep position change (tolerance too tight)
- Line 157: Relative error calculation (division by zero)
- Line 199: True anomaly after 100 periods (2π wrapping)
- Status: Test tolerance and 2π wrapping issues
- Priority: High
#### Non-Critical Issues (4 failures):
3. **test_newton_raphson_convergence.cpp:164** - Boundary cases (e=0.9999, 1.0001)
- Note: Tests pass but may have convergence issues for near-parabolic orbits
- Status: Edge case, may be acceptable
- Priority: Low
4. **test_precision_boundaries.cpp** - 2 failures
- Line 99: Polar orbit Z-coordinate (expected Z=7.5e6, actual Z=0)
- Line 233: Angular momentum conservation error (41.4%)
- Status: Polar orbit transformation issue
- Priority: Medium
5. **test_root_body_transitions.toml** - Config validation
- Issue: "PlanetA and PlanetB have overlapping SOIs while sharing same parent 'Sun'"
- Status: Config file needs adjustment
- Priority: Low
### Tests with Partial Failures (still tracked as completed):
4. ✅ test_analytical_propagation_apsides.cpp + .toml
- Status: PARTIAL (4/5 assertions passing)
- Failing test: "v_perigee > v_before" - test logic issue (both at same anomaly)
- Tests:
- Propagation through perigee (velocity maximum)
- Propagation through apogee (velocity minimum)
- At exact orbital period: should return to initial state
- True anomaly accuracy after full orbit
- Vis-viva equation holds at multiple points
6. ✅ test_analytical_propagation_timesteps.cpp + .toml
- Status: PARTIAL (4/7 assertions passing)
- Failing tests:
- Small timestep position change (tolerance too tight for orbital motion)
- Relative error calculation (division by zero when expected error is 0)
- True anomaly after 100 periods (2π wrapping issue)
- Tests:
- Large timesteps: dt > 1 orbit period
- Very small timesteps: dt < 1 second
- Accuracy vs. timestep size relationship
- Mean anomaly accumulation over long propagation
7. ✅ test_precision_boundaries.cpp + .toml
- Status: PARTIAL (14/15 assertions passing)
- Failing test: Polar orbit Z-coordinate (expected Z=7.5e6, actual Z=0)
- Notes: Fixed create_simulation calls to use max_craft=3
- Tests:
- Eccentricity at exactly 0
- Inclination at 0°, 90°, 180°
- Semi-major axis sign change
- Angular momentum conservation
- 5fc7348 Fix test_analytical_propagation_apsides: measure velocity at different anomaly
- 7471d06 Fix test_analytical_propagation_timesteps: tolerance, division by zero, and 2π wrapping
- acfb47a Fix test_precision_boundaries: remove incorrect Z-coordinate check for polar orbit
- 849a212 Fix orbital_elements_to_cartesian: circular orbit velocity and refactor for clarity
- 986a94e Update test plan: document progress on 3 fixed test files
### Remaining Tests (8 files)

Loading…
Cancel
Save