reducing global variables in tests

This commit is contained in:
rusefi 2019-01-10 21:19:46 -05:00
parent 3921d36540
commit 8a2494a646
3 changed files with 13 additions and 2 deletions

View File

@ -111,6 +111,14 @@ void EngineTestHelper::clearQueue() {
engine.iHead = NULL; // let's drop whatever was scheduled just to start from a clean state engine.iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
} }
void EngineTestHelper::executeActions() {
engine.executor.executeAll(timeNowUs);
}
void EngineTestHelper::moveTimeForwardUs(int deltaTimeUs) {
timeNowUs += deltaTimeUs;
}
void EngineTestHelper::fireTriggerEvents(int count) { void EngineTestHelper::fireTriggerEvents(int count) {
fireTriggerEvents2(count, 5); // 5ms fireTriggerEvents2(count, 5); // 5ms
} }

View File

@ -31,6 +31,9 @@ public:
void fireTriggerEvents2(int count, int delayMs); void fireTriggerEvents2(int count, int delayMs);
void clearQueue(); void clearQueue();
void executeActions();
void moveTimeForwardUs(int deltaTimeUs);
Engine engine; Engine engine;
persistent_config_s persistentConfig; persistent_config_s persistentConfig;
}; };

View File

@ -1171,8 +1171,8 @@ void testFuelSchedulerBug299smallAndLarge(void) {
assertInjectorUpEvent("L05@2", 2, MS2US(18), 1 PASS_ENGINE_PARAMETER_SUFFIX); assertInjectorUpEvent("L05@2", 2, MS2US(18), 1 PASS_ENGINE_PARAMETER_SUFFIX);
assertInjectorDownEvent("L05@3", 3, MS2US(20), 1 PASS_ENGINE_PARAMETER_SUFFIX); assertInjectorDownEvent("L05@3", 3, MS2US(20), 1 PASS_ENGINE_PARAMETER_SUFFIX);
timeNowUs += MS2US(20); eth.moveTimeForwardUs(MS2US(20));
engine->executor.executeAll(timeNowUs); eth.executeActions();
} }
void testSparkReverseOrderBug319(void) { void testSparkReverseOrderBug319(void) {