From 742ea28dd9111c8ac796524e9cd3787118684d20 Mon Sep 17 00:00:00 2001 From: Saibernard <112599512+Saibernard@users.noreply.github.com> Date: Thu, 10 Sep 2026 03:07:27 -0400 Subject: [PATCH] fix(tests): avoid float to double promotions in two new test files (#28650) The route projection test assigns the float NAN macro to double latitude fields and the vision target estimator test assigns a float altitude to the double altitude_msl_m field. The macOS toolchain rejects both under -Wdouble-promotion with -Werror, so the test suite stopped building there after #28248 and #28552. Cast at the three sites, as the other tests do. Assisted-by: Claude:claude-fable-5 Signed-off-by: Saibernard Yogendran --- src/modules/navigator/test/test_mission_route_projection.cpp | 4 ++-- .../vision_target_estimator/test/TEST_VTE_VisionTargetEst.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/navigator/test/test_mission_route_projection.cpp b/src/modules/navigator/test/test_mission_route_projection.cpp index c7bdc363b3c..951f35b8f5a 100644 --- a/src/modules/navigator/test/test_mission_route_projection.cpp +++ b/src/modules/navigator/test/test_mission_route_projection.cpp @@ -949,7 +949,7 @@ TEST_F(RouteSegmentCursorTest, IgnoresInvalidAndUnreadableItemsAfterLand) }; if (!fail_tail_load) { - mission[3].lat = NAN; + mission[3].lat = static_cast(NAN); } VectorProvider provider = makeRouteProvider(mission); @@ -1199,7 +1199,7 @@ INSTANTIATE_TEST_SUITE_P( InvalidVehiclePositions, MissionRouteProjectionInvalidVehiclePositionTest, ::testing::Values( - InvalidVehiclePositionCase{"NonFinite", NAN, kBaseLon}, + InvalidVehiclePositionCase{"NonFinite", static_cast(NAN), kBaseLon}, InvalidVehiclePositionCase{"NullIsland", 0.0, 0.0}, InvalidVehiclePositionCase{"LatitudeOutOfRange", 91.0, kBaseLon}, InvalidVehiclePositionCase{"LongitudeOutOfRange", kBaseLat, 181.0} diff --git a/src/modules/vision_target_estimator/test/TEST_VTE_VisionTargetEst.cpp b/src/modules/vision_target_estimator/test/TEST_VTE_VisionTargetEst.cpp index d1e3882e0f7..0e56a4ec4cc 100644 --- a/src/modules/vision_target_estimator/test/TEST_VTE_VisionTargetEst.cpp +++ b/src/modules/vision_target_estimator/test/TEST_VTE_VisionTargetEst.cpp @@ -345,7 +345,7 @@ protected: msg.timestamp_sample = timestamp; msg.latitude_deg = lat; msg.longitude_deg = lon; - msg.altitude_msl_m = alt_amsl; + msg.altitude_msl_m = static_cast(alt_amsl); msg.fix_type = fix_type; ASSERT_TRUE(_uav_gps_pub->publish(msg)); }