refactoring unit tests

This commit is contained in:
rusefi 2018-03-04 16:38:01 -05:00
parent cc889cf315
commit f7b3e16d8f
3 changed files with 9 additions and 4 deletions

View File

@ -91,8 +91,12 @@ void EngineTestHelper::fireTriggerEvents2(int count, int durationUs) {
}
}
void EngineTestHelper::clearQueue() {
engine.iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
}
void EngineTestHelper::fireTriggerEvents(int count) {
fireTriggerEvents2(count, 5000); // 5ms
fireTriggerEvents2(count, MS2US(5)); // 5ms
}
void EngineTestHelper::applyTriggerShape() {

View File

@ -20,6 +20,7 @@ public:
void firePrimaryTriggerFall();
void fireTriggerEvents(int count);
void fireTriggerEvents2(int count, int durationUs);
void clearQueue();
persistent_config_s persistentConfig;
Engine engine;

View File

@ -331,7 +331,7 @@ void testRpmCalculator(void) {
schedulingQueue.executeAll(99999999); // this is needed to clear 'isScheduled' flag
assertEqualsM("queue size/0", 0, schedulingQueue.size());
engine->iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
eth.clearQueue();
debugSignalExecutor = true;
@ -618,7 +618,7 @@ void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth) {
Engine *engine = &eth->engine;
EXPAND_Engine
engine->iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
eth->clearQueue();
assertEquals(LM_PLAIN_MAF, engineConfiguration->fuelAlgorithm);
engineConfiguration->isIgnitionEnabled = false; // let's focus on injection
@ -656,7 +656,7 @@ static void setTestBug299(EngineTestHelper *eth) {
assertEqualsM("RPM#2", 3000, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
schedulingQueue.executeAll(99999999); // this is needed to clear 'isScheduled' flag
engine->iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
eth->clearQueue();
/**
* Trigger up - scheduling fuel for full engine cycle