#571 unit test coverage
This commit is contained in:
rusefi 2018-03-05 08:25:20 -05:00
parent 06f64484fb
commit b590d28e7a
2 changed files with 13 additions and 2 deletions

View File

@ -521,7 +521,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
// Check if the engine is not stopped or cylinder cleanup is activated
static bool isPrimeInjectionPulseSkipped(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE))
if (!engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE))
return true;
return CONFIG(isCylinderCleanupEnabled) && (getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CLEANUP_MODE_TPS);
}

View File

@ -50,10 +50,21 @@ void testStartOfCrankingPrimingPulse() {
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
// this -70 value comes from CLT error handling code
assertEqualsM("CLT#1", 70, engine->sensors.clt);
// we need below freezing temperature to get prime fuel
// todo: less cruel CLT value assignment which would survive 'updateSlowSensors'
engine->sensors.clt = -10;
// this is needed to update injectorLag
// engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
// assertEqualsM("CLT#2", -10, engine->sensors.clt);
// prod code invokes this on ECU start, here we have to mimic this behavior
startPrimeInjectionPulse(PASS_ENGINE_PARAMETER_SIGNATURE);
assertEqualsM("prime fuel", 0, schedulingQueue.size());
assertEqualsM("prime fuel", 1, schedulingQueue.size());
}