From e5275eda9efcbd856695b4594087dcb4e2aa99d2 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sat, 9 May 2026 12:42:41 -0400 Subject: [PATCH] Use tolerance constants (ANG_TOL, R_TOL) instead of hardcoded values --- tests/test_true_anomaly_roundtrip.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_true_anomaly_roundtrip.cpp b/tests/test_true_anomaly_roundtrip.cpp index 693bf61..96684a1 100644 --- a/tests/test_true_anomaly_roundtrip.cpp +++ b/tests/test_true_anomaly_roundtrip.cpp @@ -2,6 +2,7 @@ #include #include "../src/physics.h" #include "../src/orbital_mechanics.h" +#include "../src/test_utilities.h" #include using Catch::Matchers::WithinAbs; @@ -28,7 +29,7 @@ SCENARIO("True anomaly round-trip conversion and radius sanity checks", INFO("Expected nu: " << expected_nu); INFO("Reconstructed: " << reconstructed.true_anomaly); - REQUIRE_THAT(reconstructed.true_anomaly, WithinAbs(expected_nu, 1e-12)); + REQUIRE_THAT(reconstructed.true_anomaly, WithinAbs(expected_nu, ANG_TOL)); }; SECTION("at periapsis (nu = 0)") { check_roundtrip(0.0); } @@ -43,7 +44,7 @@ SCENARIO("True anomaly round-trip conversion and radius sanity checks", INFO("Expected r: " << expected_r_peri); INFO("Calculated r: " << r_peri); - REQUIRE_THAT(r_peri, WithinAbs(expected_r_peri, 1e-6)); + REQUIRE_THAT(r_peri, WithinAbs(expected_r_peri, R_TOL)); } SECTION("apoapsis radius = a*(1+e)") { @@ -54,6 +55,6 @@ SCENARIO("True anomaly round-trip conversion and radius sanity checks", INFO("Expected r: " << expected_r_apo); INFO("Calculated r: " << r_apo); - REQUIRE_THAT(r_apo, WithinAbs(expected_r_apo, 1e-6)); + REQUIRE_THAT(r_apo, WithinAbs(expected_r_apo, R_TOL)); } }