Browse Source

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

master
bresch 4 years ago committed by Paul Riseborough
parent
commit
211c84c85b
  1. 13
      test/test_SensorRangeFinder.cpp

13
test/test_SensorRangeFinder.cpp

@ -233,6 +233,19 @@ TEST_F(SensorRangeFinderTest, rangeStuck) @@ -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)

Loading…
Cancel
Save