From 8b305acf689b5ab7d8a75757e39de8665c5f3e0d Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Tue, 28 Jul 2020 14:27:34 -0700 Subject: [PATCH] fix tests --- unit_tests/engine_test_helper.cpp | 1 - .../tests/ignition_injection/test_fuelCut.cpp | 4 ++++ unit_tests/tests/test_fuel_map.cpp | 1 + unit_tests/tests/trigger/test_trigger_decoder.cpp | 14 ++++++++++++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index 011eca0d30..e0ef38c70b 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -319,7 +319,6 @@ void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e inject eth->clearQueue(); - ASSERT_EQ(LM_MOCK, engineConfiguration->fuelAlgorithm); engineConfiguration->isIgnitionEnabled = false; // let's focus on injection engineConfiguration->specs.cylindersCount = 4; // a bit of flexibility - the mode may be changed by some tests diff --git a/unit_tests/tests/ignition_injection/test_fuelCut.cpp b/unit_tests/tests/ignition_injection/test_fuelCut.cpp index 21c7f6f540..47396bcdd7 100644 --- a/unit_tests/tests/ignition_injection/test_fuelCut.cpp +++ b/unit_tests/tests/ignition_injection/test_fuelCut.cpp @@ -11,8 +11,12 @@ #include "sensor.h" #include "fsio_impl.h" +using ::testing::_; + TEST(fuelCut, coasting) { WITH_ENGINE_TEST_HELPER(TEST_ENGINE); + EXPECT_CALL(eth.mockAirmass, getAirmass(_)) + .WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f})); // configure coastingFuelCut engineConfiguration->coastingFuelCutEnabled = true; diff --git a/unit_tests/tests/test_fuel_map.cpp b/unit_tests/tests/test_fuel_map.cpp index 1736cc7c89..14dbbcb386 100644 --- a/unit_tests/tests/test_fuel_map.cpp +++ b/unit_tests/tests/test_fuel_map.cpp @@ -21,6 +21,7 @@ using ::testing::FloatNear; TEST(misc, testFuelMap) { printf("Setting up FORD_ASPIRE_1996\r\n"); WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996); + engineConfiguration->fuelAlgorithm = LM_PLAIN_MAF; printf("Filling fuel map\r\n"); for (int k = 0; k < FUEL_LOAD_COUNT; k++) { diff --git a/unit_tests/tests/trigger/test_trigger_decoder.cpp b/unit_tests/tests/trigger/test_trigger_decoder.cpp index 58d33dcfe5..5aa73cccec 100644 --- a/unit_tests/tests/trigger/test_trigger_decoder.cpp +++ b/unit_tests/tests/trigger/test_trigger_decoder.cpp @@ -23,6 +23,8 @@ #include "trigger_universal.h" #include "sensor.h" +using ::testing::_; + extern WarningCodeState unitTestWarningCodeState; extern bool printTriggerDebug; extern float actualSynchGap; @@ -295,9 +297,10 @@ static void assertREqualsM(const char *msg, void *expected, void *actual) { extern bool_t debugSignalExecutor; TEST(misc, testRpmCalculator) { - printf("*************************************************** testRpmCalculator\r\n"); - WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995); + EXPECT_CALL(eth.mockAirmass, getAirmass(_)) + .WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f})); + IgnitionEventList *ilist = &engine->ignitionEvents; ASSERT_EQ( 0, ilist->isReady) << "size #1"; @@ -588,6 +591,8 @@ static void assertInjectionEventBatch(const char *msg, InjectionEvent *ev, int i } static void setTestBug299(EngineTestHelper *eth) { + // TODO: switch to mock airmass + eth->persistentConfig.engineConfiguration.fuelAlgorithm = LM_PLAIN_MAF; setupSimpleTestEngineWithMafAndTT_ONE_trigger(eth); Engine *engine = ð->engine; EXPAND_Engine @@ -977,6 +982,8 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) { TEST(big, testTwoWireBatch) { WITH_ENGINE_TEST_HELPER(TEST_ENGINE); setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð); + EXPECT_CALL(eth.mockAirmass, getAirmass(_)) + .WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f})); engineConfiguration->injectionMode = IM_BATCH; engineConfiguration->twoWireBatchInjection = true; @@ -1002,6 +1009,9 @@ TEST(big, testTwoWireBatch) { TEST(big, testSequential) { WITH_ENGINE_TEST_HELPER(TEST_ENGINE); + EXPECT_CALL(eth.mockAirmass, getAirmass(_)) + .WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f})); + setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð); engineConfiguration->injectionMode = IM_SEQUENTIAL;