mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-29 11:40:28 +08:00
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 <bernie97@seas.upenn.edu>
This commit is contained in:
1 parent
2a0e910923
commit
742ea28dd9
2 files changed
+3
-3
No files matched your search
@@ -949,7 +949,7 @@ TEST_F(RouteSegmentCursorTest, IgnoresInvalidAndUnreadableItemsAfterLand)
|
||||
};
|
||||
|
||||
if (!fail_tail_load) {
|
||||
mission[3].lat = NAN;
|
||||
mission[3].lat = static_cast<double>(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<double>(NAN), kBaseLon},
|
||||
InvalidVehiclePositionCase{"NullIsland", 0.0, 0.0},
|
||||
InvalidVehiclePositionCase{"LatitudeOutOfRange", 91.0, kBaseLon},
|
||||
InvalidVehiclePositionCase{"LongitudeOutOfRange", kBaseLat, 181.0}
|
||||
|
||||
@@ -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<double>(alt_amsl);
|
||||
msg.fix_type = fix_type;
|
||||
ASSERT_TRUE(_uav_gps_pub->publish(msg));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user