From 64d3c12c52ccbb42616145a312c8a9e51f5380f0 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sun, 1 Feb 2026 12:54:39 -0500 Subject: [PATCH] fix: Update test expectations for normalized true_anomaly values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update 5 tests to expect true_anomaly in (-π, π] normalized range - 3π/2 → -π/2, -3π/2 → π/2 (normalized quadrature points) - 5.0 rad → -1.283 rad, -5.0 rad → 1.283 rad (normalized) - 10.0 rad → -2.566 rad (normalized) - Matches mathematically correct atan2() output range - Test improvement: 7 → 2 assertion failures (71% reduction) --- tests/test_cartesian_to_elements_quadrature.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_cartesian_to_elements_quadrature.cpp b/tests/test_cartesian_to_elements_quadrature.cpp index 7586e93..73076d4 100644 --- a/tests/test_cartesian_to_elements_quadrature.cpp +++ b/tests/test_cartesian_to_elements_quadrature.cpp @@ -71,7 +71,7 @@ TEST_CASE("Cartesian to Elements - Quadrature Points", "[orbital_mechanics]") { REQUIRE_THAT(recovered.eccentricity, WithinAbs(0.5, 1e-4)); REQUIRE_THAT(recovered.semi_major_axis, WithinAbs(1.0e11, 1e6)); - REQUIRE_THAT(recovered.true_anomaly, WithinAbs(3.0 * M_PI / 2.0, 1e-6)); + REQUIRE_THAT(recovered.true_anomaly, WithinAbs(-M_PI / 2.0, 1e-6)); } SECTION("Quadrature point ν=-3π/2 (-270°) preserves orbital elements") { @@ -91,7 +91,7 @@ TEST_CASE("Cartesian to Elements - Quadrature Points", "[orbital_mechanics]") { REQUIRE_THAT(recovered.eccentricity, WithinAbs(0.5, 1e-4)); REQUIRE_THAT(recovered.semi_major_axis, WithinAbs(1.0e11, 1e6)); - REQUIRE_THAT(recovered.true_anomaly, WithinAbs(-3.0 * M_PI / 2.0, 1e-6)); + REQUIRE_THAT(recovered.true_anomaly, WithinAbs(M_PI / 2.0, 1e-6)); } SECTION("Quadrature point with high eccentricity (e=0.9) preserves accuracy") { @@ -151,7 +151,7 @@ TEST_CASE("Cartesian to Elements - Quadrature Points", "[orbital_mechanics]") { REQUIRE_THAT(recovered.eccentricity, WithinAbs(0.5, 1e-4)); REQUIRE_THAT(recovered.semi_major_axis, WithinAbs(1.0e11, 1e6)); - REQUIRE_THAT(recovered.true_anomaly, WithinAbs(5.0, 1e-6)); + REQUIRE_THAT(recovered.true_anomaly, WithinAbs(-1.28318530717958623, 1e-6)); } SECTION("Large negative true anomaly ν=-5.0 rad (≈-286°) preserves accuracy") { @@ -171,7 +171,7 @@ TEST_CASE("Cartesian to Elements - Quadrature Points", "[orbital_mechanics]") { REQUIRE_THAT(recovered.eccentricity, WithinAbs(0.5, 1e-4)); REQUIRE_THAT(recovered.semi_major_axis, WithinAbs(1.0e11, 1e6)); - REQUIRE_THAT(recovered.true_anomaly, WithinAbs(-5.0, 1e-6)); + REQUIRE_THAT(recovered.true_anomaly, WithinAbs(1.28318530717958623, 1e-6)); } SECTION("Very large true anomaly ν=10.0 rad (≈573°) preserves accuracy") { @@ -191,7 +191,7 @@ TEST_CASE("Cartesian to Elements - Quadrature Points", "[orbital_mechanics]") { REQUIRE_THAT(recovered.eccentricity, WithinAbs(0.5, 1e-4)); REQUIRE_THAT(recovered.semi_major_axis, WithinAbs(1.0e11, 1e6)); - REQUIRE_THAT(recovered.true_anomaly, WithinAbs(10.0, 1e-5)); + REQUIRE_THAT(recovered.true_anomaly, WithinAbs(-2.56637061435917246, 1e-5)); } SECTION("Quadrature point with 3D orientation preserves all elements") {