From d7cdf75e221772cd5efa07623526e759610cab46 Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 28 Nov 2022 23:41:51 -0500 Subject: [PATCH] unit test compile more of ETB code --- .../controllers/actuators/electronic_throttle.cpp | 2 -- unit_tests/tests/actuators/test_etb.cpp | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 7aac498daa..e299a8082e 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -1008,11 +1008,9 @@ void initElectronicThrottle() { return; } -#if !EFI_UNIT_TEST for (int i = 0; i < ETB_COUNT; i++) { engine->etbControllers[i] = etbControllers[i]; } -#endif #if EFI_PROD_CODE addConsoleAction("etbinfo", showEtbInfo); diff --git a/unit_tests/tests/actuators/test_etb.cpp b/unit_tests/tests/actuators/test_etb.cpp index 45e423d769..2655788584 100644 --- a/unit_tests/tests/actuators/test_etb.cpp +++ b/unit_tests/tests/actuators/test_etb.cpp @@ -31,7 +31,7 @@ TEST(etb, initializationNoPedal) { EXPECT_CALL(mocks[1], init(ETB_Throttle2, _, _, _, false)).WillOnce(Return(false)); // This shouldn't throw, since no throttles are configured, but no pedal is configured either - EXPECT_NO_FATAL_ERROR(initElectronicThrottle()); + EXPECT_NO_FATAL_ERROR(doInitElectronicThrottle()); } TEST(etb, initializationMissingThrottle) { @@ -54,7 +54,7 @@ TEST(etb, initializationMissingThrottle) { Sensor::setMockValue(SensorType::AcceleratorPedalPrimary, 0); // This should throw: a pedal is configured but no throttles - EXPECT_FATAL_ERROR(initElectronicThrottle()); + EXPECT_FATAL_ERROR(doInitElectronicThrottle()); } TEST(etb, initializationSingleThrottle) { @@ -79,7 +79,7 @@ TEST(etb, initializationSingleThrottle) { // Expect mock1 to be init as none EXPECT_CALL(mocks[1], init(ETB_None, _, _, _, true)).Times(0); - initElectronicThrottle(); + doInitElectronicThrottle(); } TEST(etb, initializationSingleThrottleInSecondSlot) { @@ -104,7 +104,7 @@ TEST(etb, initializationSingleThrottleInSecondSlot) { // Expect mock1 to be init as throttle 1, and PID params EXPECT_CALL(mocks[1], init(ETB_Throttle1, _, &engineConfiguration->etb, Ne(nullptr), true)).WillOnce(Return(true)); - initElectronicThrottle(); + doInitElectronicThrottle(); } TEST(etb, initializationDualThrottle) { @@ -132,7 +132,7 @@ TEST(etb, initializationDualThrottle) { // Expect mock1 to be init as throttle 2, and PID params EXPECT_CALL(mocks[1], init(ETB_Throttle2, _, &engineConfiguration->etb, Ne(nullptr), true)).WillOnce(Return(true)); - initElectronicThrottle(); + doInitElectronicThrottle(); } TEST(etb, initializationWastegate) { @@ -153,7 +153,7 @@ TEST(etb, initializationWastegate) { // Expect mock1 to be init as none EXPECT_CALL(mocks[1], init(ETB_None, _, _, _, false)).Times(0); - initElectronicThrottle(); + doInitElectronicThrottle(); } TEST(etb, initializationNoFunction) {