reviving unit tests. too bad unit tests are coupled with cranking base fuel values :(

This commit is contained in:
rusefi 2019-04-04 09:17:12 -04:00
parent cd7cc596bc
commit be926cb792
3 changed files with 9 additions and 9 deletions

View File

@ -53,7 +53,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
// test if ignition mode is temporary changed to wasted spark, if set to individual coils
ASSERT_EQ(IM_WASTED_SPARK, getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
// check real events
eth.assertEvent5(&engine->executor, "inj start#1", 0, (void*)startSimultaniousInjection, timeStartUs, MS2US(200) + 97975);
eth.assertEvent5(&engine->executor, "inj start#1", 0, (void*)startSimultaniousInjection, timeStartUs, MS2US(200) + 81250);
eth.assertEvent5(&engine->executor, "inj end#1", 1, (void*)endSimultaniousInjection, timeStartUs, MS2US(200) + 100000);
// skip the rest of the cycle
@ -75,7 +75,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
// two simultaneous injections
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
// check real events
eth.assertEvent5(&engine->executor, "inj start#2", 0, (void*)startSimultaniousInjection, eth.getTimeNowUs(), 147975);
eth.assertEvent5(&engine->executor, "inj start#2", 0, (void*)startSimultaniousInjection, eth.getTimeNowUs(), 131250);
eth.assertEvent5(&engine->executor, "inj end#2", 1, (void*)endSimultaniousInjection, eth.getTimeNowUs(), 150000);
// skip, clear & advance 1 more revolution at higher RPM
@ -96,8 +96,8 @@ TEST(cranking, testFasterEngineSpinningUp) {
// check real events for sequential injection
// Note: See addFuelEvents() fix inside setRpmValue()!
eth.assertEvent5(&engine->executor, "inj start#3", 0, (void*)seTurnPinHigh, timeStartUs, MS2US(60) + 27974);
eth.assertEvent5(&engine->executor, "inj end#3", 1, (void*)seTurnPinLow, timeStartUs, MS2US(60) + 27974 + 3000);
eth.assertEvent5(&engine->executor, "inj start#3", 0, (void*)seTurnPinHigh, timeStartUs, MS2US(60) + 11250);
eth.assertEvent5(&engine->executor, "inj end#3", 1, (void*)seTurnPinLow, timeStartUs, MS2US(60) + 11250 + 3000);
}
static void doTestFasterEngineSpinningUp60_2(int startUpDelayMs, int rpm1, int expectedRpm) {

View File

@ -110,10 +110,10 @@ TEST(misc, testFuelMap) {
printf("*************************************************** getStartingFuel\r\n");
// NAN in case we have issues with the CLT sensor
ASSERT_EQ( 4, getCrankingFuel3(NAN, 0 PASS_ENGINE_PARAMETER_SUFFIX)) << "getStartingFuel nan";
assertEqualsM("getStartingFuel#1", 17.8, getCrankingFuel3(0, 4 PASS_ENGINE_PARAMETER_SUFFIX));
assertEqualsM("getStartingFuel#2", 8.4480, getCrankingFuel3(8, 15 PASS_ENGINE_PARAMETER_SUFFIX));
assertEqualsM("getStartingFuel#3", 6.48, getCrankingFuel3(70, 0 PASS_ENGINE_PARAMETER_SUFFIX));
assertEqualsM("getStartingFuel#4", 2.6069, getCrankingFuel3(70, 50 PASS_ENGINE_PARAMETER_SUFFIX));
assertEqualsM("getStartingFuel#1", 116, getCrankingFuel3(0, 4 PASS_ENGINE_PARAMETER_SUFFIX));
assertEqualsM("getStartingFuel#2", 58.2120, getCrankingFuel3(8, 15 PASS_ENGINE_PARAMETER_SUFFIX));
assertEqualsM("getStartingFuel#3", 60.00, getCrankingFuel3(70, 0 PASS_ENGINE_PARAMETER_SUFFIX));
assertEqualsM("getStartingFuel#4", 24.1379, getCrankingFuel3(70, 50 PASS_ENGINE_PARAMETER_SUFFIX));
}

View File

@ -25,7 +25,7 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
// two simultaneous injections
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
eth.assertEvent5(&engine->executor, "sim start", 0, (void*)startSimultaniousInjection, eth.getTimeNowUs(), 97975);
eth.assertEvent5(&engine->executor, "sim start", 0, (void*)startSimultaniousInjection, eth.getTimeNowUs(), 81250);
eth.assertEvent5(&engine->executor, "sim end", 1, (void*)endSimultaniousInjection, eth.getTimeNowUs(), 100000);
}