Rng finder unit test: cover "un-stuck" logic

This commit is contained in:
bresch 2021-01-04 11:18:17 +01:00 committed by Paul Riseborough
parent 78ce46f007
commit 211c84c85b
1 changed files with 13 additions and 0 deletions

View File

@ -233,6 +233,19 @@ TEST_F(SensorRangeFinderTest, rangeStuck)
// because the sensor is "stuck"
EXPECT_FALSE(_range_finder.isDataHealthy());
EXPECT_FALSE(_range_finder.isHealthy());
// BUT WHEN: we continue to send samples but with changing distance
for (int i = 0; i < 2; i++) {
new_sample.rng += 1.f;
_range_finder.setSample(new_sample);
_range_finder.runChecks(new_sample.time_us, attitude);
new_sample.time_us += dt;
}
// THEN: the data should be marked as healthy
// because the sensor is not "stuck" anymore
EXPECT_TRUE(_range_finder.isDataHealthy());
EXPECT_TRUE(_range_finder.isHealthy());
}
TEST_F(SensorRangeFinderTest, qualityHysteresis)