unit test for vehicle_speed.cpp fix #3081
This commit is contained in:
parent
6d12533120
commit
75f27c6cbc
|
@ -38,8 +38,6 @@ static void simulatePeriodicSignalForCallback(
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(VehicleSpeedSensor, testValidSpeedDetection) {
|
TEST(VehicleSpeedSensor, testValidSpeedDetection) {
|
||||||
// Setup
|
|
||||||
setMockVehicleSpeed(-1);
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||||
CONFIG(vehicleSpeedSensorInputPin) = anyPin;
|
CONFIG(vehicleSpeedSensorInputPin) = anyPin;
|
||||||
engineConfiguration->vehicleSpeedCoef = 0.5f;
|
engineConfiguration->vehicleSpeedCoef = 0.5f;
|
||||||
|
@ -50,13 +48,10 @@ TEST(VehicleSpeedSensor, testValidSpeedDetection) {
|
||||||
float measuredSpeed = getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE);
|
float measuredSpeed = getVehicleSpeed(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
EXPECT_NEAR(15.0f, measuredSpeed, 0.01);
|
EXPECT_NEAR(15.0f, measuredSpeed, 0.01);
|
||||||
|
|
||||||
// Tear down
|
|
||||||
setMockVehicleSpeed(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(VehicleSpeedSensor, testInvalidSpeed) {
|
TEST(VehicleSpeedSensor, testInvalidSpeed) {
|
||||||
// Setup
|
|
||||||
setMockVehicleSpeed(-1);
|
|
||||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||||
CONFIG(vehicleSpeedSensorInputPin) = anyPin;
|
CONFIG(vehicleSpeedSensorInputPin) = anyPin;
|
||||||
engineConfiguration->vehicleSpeedCoef = 0.5f;
|
engineConfiguration->vehicleSpeedCoef = 0.5f;
|
||||||
|
@ -68,7 +63,5 @@ TEST(VehicleSpeedSensor, testInvalidSpeed) {
|
||||||
// Direct comparasion as invalid speed shoud return true zero
|
// Direct comparasion as invalid speed shoud return true zero
|
||||||
EXPECT_EQ(0.0f, measuredSpeed);
|
EXPECT_EQ(0.0f, measuredSpeed);
|
||||||
|
|
||||||
// Tear down
|
|
||||||
setMockVehicleSpeed(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue