parent
8c5be72106
commit
217081c174
|
@ -35,6 +35,7 @@ bool Sensor::Register() {
|
|||
auto &entry = s_sensorRegistry[i];
|
||||
|
||||
entry.sensor = nullptr;
|
||||
entry.useMock = false;
|
||||
entry.mockValue = 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,3 +90,28 @@ TEST_F(SensorMocking, ResetAll) {
|
|||
EXPECT_FLOAT_EQ(result.Value, 46.0f);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SensorMocking, ResetWithResetRegistry) {
|
||||
// Set a value on the "real" sensor
|
||||
realSensor.set(46.0f);
|
||||
|
||||
// Now set a mock value
|
||||
Sensor::setMockValue(SensorType::Clt, 33.0f);
|
||||
|
||||
// Expect to see the mock value
|
||||
{
|
||||
auto result = Sensor::get(SensorType::Clt);
|
||||
EXPECT_TRUE(result.Valid);
|
||||
EXPECT_FLOAT_EQ(result.Value, 33.0f);
|
||||
}
|
||||
|
||||
// Reset registry - including mocks
|
||||
Sensor::resetRegistry();
|
||||
|
||||
{
|
||||
auto result = Sensor::get(SensorType::Clt);
|
||||
EXPECT_TRUE(result.Valid);
|
||||
EXPECT_FLOAT_EQ(result.Value, 46.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue