From dfd5b11c8f614aa41d1de2817ab338f59dd66da6 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Fri, 27 Sep 2019 20:33:45 -0400 Subject: [PATCH] Revert "Fix sensor mocking bug (#956)" This reverts commit 217081c1 --- firmware/controllers/sensors/sensor.cpp | 1 - unit_tests/tests/sensor/mock_sensor.cpp | 25 ------------------------- 2 files changed, 26 deletions(-) diff --git a/firmware/controllers/sensors/sensor.cpp b/firmware/controllers/sensors/sensor.cpp index 77adb53e01..2406ee5d26 100644 --- a/firmware/controllers/sensors/sensor.cpp +++ b/firmware/controllers/sensors/sensor.cpp @@ -35,7 +35,6 @@ bool Sensor::Register() { auto &entry = s_sensorRegistry[i]; entry.sensor = nullptr; - entry.useMock = false; entry.mockValue = 0.0f; } } diff --git a/unit_tests/tests/sensor/mock_sensor.cpp b/unit_tests/tests/sensor/mock_sensor.cpp index dad911f50f..789241732a 100644 --- a/unit_tests/tests/sensor/mock_sensor.cpp +++ b/unit_tests/tests/sensor/mock_sensor.cpp @@ -90,28 +90,3 @@ 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); - } -} -