test(battery): a NaN voltage sample doesn't trigger a false positive warning (#29526)

This commit is contained in:
Daniel Buleandră authored and GitHub committed 2026-10-30 18:21:42 +01:00
1 parent d02e110e97
commit 443cca4482
1 file changed
+3 -3
+3 -3
View File
@@ -97,8 +97,8 @@ TEST_F(BatteryTest, UnknownCellCountWithCapacityStaysUnknown)
EXPECT_FALSE(PX4_ISFINITE(status.time_remaining_s));
}
// a NaN voltage with a configured capacity must not hide the emergency
TEST_F(BatteryTest, NanVoltageWithCapacityIsAnEmergency)
// a NaN voltage sample is skipped and doesn't directly trigger a false positive warning,
TEST_F(BatteryTest, NanVoltageIsSkipped)
{
int32_t n_cells = 3;
param_set(param_find("BAT1_N_CELLS"), &n_cells);
@@ -107,7 +107,7 @@ TEST_F(BatteryTest, NanVoltageWithCapacityIsAnEmergency)
Battery battery(1, nullptr, 20_ms, battery_status_s::SOURCE_ESCS);
const battery_status_s status = run(battery, NAN, 1.f);
EXPECT_EQ(status.warning, battery_status_s::WARNING_EMERGENCY);
EXPECT_EQ(status.warning, battery_status_s::WARNING_NONE);
}
TEST_F(BatteryTest, KnownCellCountEstimatesCharge)