diff --git a/unit_tests/tests/trigger/test_real_cranking_nissan_vq40.cpp b/unit_tests/tests/trigger/test_real_cranking_nissan_vq40.cpp index 2f09a413b3..a96da554d8 100644 --- a/unit_tests/tests/trigger/test_real_cranking_nissan_vq40.cpp +++ b/unit_tests/tests/trigger/test_real_cranking_nissan_vq40.cpp @@ -8,11 +8,12 @@ #include "pch.h" #include "logicdata_csv_reader.h" -static void test(int engineSyncCam, float camOffsetAdd) { +static void test(int engineSyncCam, float camOffsetAdd, int warningsCount) { CsvReader reader(1, /* vvtCount */ 2); reader.open("tests/trigger/resources/nissan_vq40_cranking-1.csv"); EngineTestHelper eth (engine_type_e::HELLEN_121_NISSAN_6_CYL); + setWholeTimingTable(0); engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->alwaysInstantRpm = true; @@ -49,17 +50,21 @@ static void test(int engineSyncCam, float camOffsetAdd) { ASSERT_EQ(102, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex(); // TODO: why warnings? - ASSERT_EQ(2, eth.recentWarnings()->getCount()); - ASSERT_EQ(ObdCode::CUSTOM_OUT_OF_ORDER_COIL, eth.recentWarnings()->get(0).Code); // this is from a coil being protected by overdwell protection - ASSERT_EQ(ObdCode::CUSTOM_PRIMARY_TOO_MANY_TEETH, eth.recentWarnings()->get(1).Code); + ASSERT_EQ(warningsCount, eth.recentWarnings()->getCount()); + if (warningsCount == 2) { + ASSERT_EQ(ObdCode::CUSTOM_OUT_OF_ORDER_COIL, eth.recentWarnings()->get(0).Code); // this is from a coil being protected by overdwell protection + ASSERT_EQ(ObdCode::CUSTOM_PRIMARY_TOO_MANY_TEETH, eth.recentWarnings()->get(1).Code); + } else { + ASSERT_EQ(ObdCode::CUSTOM_PRIMARY_TOO_MANY_TEETH, eth.recentWarnings()->get(0).Code); + } } // On Nissan VQ, all cams have the same pattern, so all should be equally good for engine sync. Check them all! TEST(realCrankingVQ40, normalCrankingSyncCam1) { - test(1, 0); + test(1, 0, 1); } TEST(realCrankingVQ40, normalCrankingSyncCam2) { - test(2, -360); + test(2, -360, 2); }