Browse Source

test_omega_debug: remove redundant qualitative checks, clean up precalc decorative comments

test-refactor
cinnaboot 3 weeks ago
parent
commit
804a82babb
  1. 2
      continue.md
  2. 8
      scripts/precalc_omega_debug.py
  3. 3
      tests/test_omega_debug.cpp

2
continue.md

@ -64,6 +64,7 @@ All constants defined in `src/test_utilities.h` — use those, do not redefine l
- `test_extreme_timescales` — 9 TEST_CASEs → 1 SCENARIO with 11 SECTIONs, all WithinAbs use named constants
- `test_analytical_propagation` — 5 SCENARIOs → 1 SCENARIO with 23 SECTIONs, precalculated values, all WithinAbs use named constants
- `test_moon_orbits` — Multi-body hierarchical propagation with local/global coordinate tracking
- `test_omega_debug` — Burn + element reconstruction + maneuver triggers
- `test_energy` — Energy calculations and conservation tests
- `test_inclined_orbits` — 3D inclined orbit conversions, Molniya orbits, rotation matrices
- `test_maneuvers` — Impulsive burn tests with precalculated values
@ -74,7 +75,6 @@ All constants defined in `src/test_utilities.h` — use those, do not redefine l
- `test_hybrid_burns` — 14 TEST_CASEs → 1 SCENARIO with 22 SECTIONs, impulse + continuous burns, precalculated values; converted 17 qualitative checks to quantitative, replaced hardcoded tolerances with named constants (A_TOL, E_TOL, D_TOL, M_TOL, ANG_TOL, R_TOL)
### Can Refactor Now (sim_engine.py supports all features needed)
- `test_omega_debug` — burn + element reconstruction + maneuver triggers
- `test_maneuver_planning` — maneuver trigger system (TIME + elliptical TRUE_ANOMALY triggers)
- `test_orbit_rendering` — rendering tests (check if sim_engine needed)
- `test_precision_boundaries` — boundary condition tests

8
scripts/precalc_omega_debug.py

@ -29,7 +29,7 @@ def main():
r = vmag(pos)
v = vmag(vel)
print("// === Initial state ===")
print("// Initial state")
print(f"// pos = ({pos[0]:.15e}, {pos[1]:.15e}, {pos[2]:.15e}) m")
print(f"// vel = ({vel[0]:.15e}, {vel[1]:.15e}, {vel[2]:.15e}) m/s")
print(f"// r = {r:.15e} m")
@ -57,7 +57,7 @@ def main():
v_new = vmag(vel_new)
print("// === After prograde burn ===")
print("// After prograde burn")
print(f"// burn_dir = ({burn_dir[0]:.15e}, {burn_dir[1]:.15e}, {burn_dir[2]:.15e})")
print(f"// vel_new = ({vel_new[0]:.15e}, {vel_new[1]:.15e}, {vel_new[2]:.15e}) m/s")
print(f"// v_new = {v_new:.15e} m/s")
@ -88,7 +88,7 @@ def main():
print()
# Verify omega is in [0, 2*pi)
print("// === Omega range check ===")
print("// Omega range check")
print(f"// omega = {new_elements.omega:.15e} rad")
print(f"// omega in [0, 2*pi)? {0.0 <= new_elements.omega < 2.0 * math.pi}")
print()
@ -107,7 +107,7 @@ def main():
# the eccentricity vector flips, meaning periapsis moves to the opposite side,
# so ω → π.
print("// === Expected test values ===")
print("// Expected test values")
print(f"// a_expected = {new_elements.a:.15e}")
print(f"// e_expected = {new_elements.e:.15e}")
print(f"// omega_expected = {new_elements.omega:.15e} rad ({math.degrees(new_elements.omega):.6f} deg)")

3
tests/test_omega_debug.cpp

@ -51,13 +51,10 @@ SCENARIO("Omega reconstruction after prograde burn at apoapsis", "[omega][debug]
const OrbitalElements new_elements = cartesian_to_orbital_elements(pos, vel_new, parent_mass);
REQUIRE_THAT(new_elements.semi_major_axis, WithinAbs(1.346885753127762e7, A_TOL));
REQUIRE(new_elements.semi_major_axis > elements.semi_major_axis);
REQUIRE_THAT(new_elements.eccentricity, WithinAbs(3.481049006486453e-2, E_TOL));
REQUIRE(new_elements.eccentricity < elements.eccentricity);
REQUIRE_THAT(new_elements.argument_of_periapsis, WithinAbs(M_PI, ANG_TOL));
REQUIRE_THAT(new_elements.true_anomaly, WithinAbs(0.0, ANG_TOL));
REQUIRE_THAT(new_elements.inclination, WithinAbs(0.0, ANG_TOL));
REQUIRE_THAT(v_new, WithinAbs(5632.763232589246, V_TOL));
REQUIRE(v_new > v);
}
}

Loading…
Cancel
Save