From 6c58be42132764072420693864ebd6a759679ab5 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 21 Jan 2019 22:45:37 -0500 Subject: [PATCH] something is not right here :( --- .../tests/test_fasterEngineSpinningUp.cpp | 19 +++++++++++++++++-- unit_tests/tests/test_trigger_decoder.cpp | 8 +++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/unit_tests/tests/test_fasterEngineSpinningUp.cpp b/unit_tests/tests/test_fasterEngineSpinningUp.cpp index f7c43063dd..5b2a47126d 100644 --- a/unit_tests/tests/test_fasterEngineSpinningUp.cpp +++ b/unit_tests/tests/test_fasterEngineSpinningUp.cpp @@ -13,6 +13,11 @@ TEST(cranking, testFasterEngineSpinningUp) { WITH_ENGINE_TEST_HELPER(TEST_ENGINE); // turn on FasterEngineSpinUp mode engineConfiguration->bc.isFasterEngineSpinUpEnabled = true; + + + // todo: it's depressing that this unit test does not survive a bit of idle time in the beginning + // todo: uncomment + //eth.moveTimeForwardMs(1000 /*ms*/); eth.firePrimaryTriggerRise(); // set ignition mode @@ -96,13 +101,23 @@ TEST(cranking, testFasterEngineSpinningUp) { eth.assertEvent5(&engine->executor, "inj end#3", 1, (void*)seTurnPinLow, timeStartUs, MS2US(60) + 27974 + 3000); } - -TEST(cranking, testFasterEngineSpinningUp60_2) { +static void doTestFasterEngineSpinningUp60_2(int startUpDelayMs, int expectedRpm) { WITH_ENGINE_TEST_HELPER(TEST_ENGINE); // turn on FasterEngineSpinUp mode engineConfiguration->bc.isFasterEngineSpinUpEnabled = true; setupSimpleTestEngineWithMaf(ð, IM_SEQUENTIAL, TT_TOOTHED_WHEEL_60_2); + eth.moveTimeForwardMs(startUpDelayMs); eth.fireTriggerEvents2(30 /* count */, 1 /*ms*/); + eth.fireTriggerEvents2(1, 4); + EXPECT_EQ(expectedRpm, GET_RPM()) << "test RPM with " + std::to_string(startUpDelayMs) + " startUpDelayMs"; +} + +TEST(cranking, testFasterEngineSpinningUp60_2) { + // I do not get it. Startup delay is affecting instance RPM? + // todo: is this feature implementation issue or test framework issue? + doTestFasterEngineSpinningUp60_2(0, 220); + doTestFasterEngineSpinningUp60_2(100, 89); + doTestFasterEngineSpinningUp60_2(1000, 0); } diff --git a/unit_tests/tests/test_trigger_decoder.cpp b/unit_tests/tests/test_trigger_decoder.cpp index 7a11f5833c..7bc4db0045 100644 --- a/unit_tests/tests/test_trigger_decoder.cpp +++ b/unit_tests/tests/test_trigger_decoder.cpp @@ -690,10 +690,11 @@ static void assertInjectors(const char *msg, int value0, int value1) { assertEqualsM4(msg, "inj#1", value1, enginePins.injectors[1].currentLogicValue); } -TEST(big, testFuelSchedulerBug299smallAndMedium) { +void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) { printf("*************************************************** testFuelSchedulerBug299 small to medium\r\n"); WITH_ENGINE_TEST_HELPER(TEST_ENGINE); + eth.moveTimeForwardMs(startUpDelayMs); // nice to know that same test works the same with different anount of idle time on start setTestBug299(ð); FuelSchedule * t; @@ -941,6 +942,11 @@ static void setInjectionMode(int value DECLARE_ENGINE_PARAMETER_SUFFIX) { incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); } +TEST(big, testFuelSchedulerBug299smallAndMedium) { + doTestFuelSchedulerBug299smallAndMedium(0); + doTestFuelSchedulerBug299smallAndMedium(1000); +} + TEST(big, testDifferentInjectionModes) { printf("*************************************************** testDifferentInjectionModes\r\n");