The Big Refactoring of 2019: scheduler should not be global #655
This commit is contained in:
parent
b3ee5ec945
commit
38b5ae5b66
|
@ -25,6 +25,9 @@ void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, schfu
|
|||
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, callback, param);
|
||||
}
|
||||
|
||||
int TestExecutor::executeAll(efitime_t now) {
|
||||
return schedulingQueue.executeAll(now);
|
||||
}
|
||||
|
||||
void TestExecutor::clear() {
|
||||
schedulingQueue.clear();
|
||||
|
|
|
@ -16,6 +16,7 @@ public:
|
|||
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param);
|
||||
void scheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param);
|
||||
void clear();
|
||||
int executeAll(efitime_t now);
|
||||
int size();
|
||||
scheduling_s* getForUnitTest(int index);
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ static void assertNextEvent(const char *msg, int expectedPinState, TestExecutor
|
|||
timeNowUs = expectedTimeOfNextEvent;
|
||||
|
||||
// execute pending actions and assert that only one action was executed
|
||||
assertEqualsM5(msg, " executed", 1, schedulingQueue.executeAll(timeNowUs), 0);
|
||||
assertEqualsM5(msg, " executed", 1, executor->executeAll(timeNowUs), 0);
|
||||
assertEqualsM5(msg, " pin state", expectedPinState, pinValue, 0);
|
||||
|
||||
// assert that we have one new action in queue
|
||||
|
|
|
@ -388,9 +388,9 @@ void testRpmCalculator(void) {
|
|||
eth.fireFall(5);
|
||||
assertEqualsM("index #3", 3, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size 3", 4, engine->executor.size());
|
||||
assertEqualsM("ev 3", start + 13333 - 1515, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM2("ev 5", start + 14277, schedulingQueue.getForUnitText(1)->momentX, 2);
|
||||
assertEqualsM("3/3", start + 14777, schedulingQueue.getForUnitText(2)->momentX);
|
||||
assertEqualsM("ev 3", start + 13333 - 1515, engine->executor.getForUnitTest(0)->momentX);
|
||||
assertEqualsM2("ev 5", start + 14277, engine->executor.getForUnitTest(1)->momentX, 2);
|
||||
assertEqualsM("3/3", start + 14777, engine->executor.getForUnitTest(2)->momentX);
|
||||
engine->executor.clear();
|
||||
|
||||
assertEquals(5, TRIGGER_SHAPE(triggerIndexByAngle[240]));
|
||||
|
@ -427,8 +427,8 @@ void testRpmCalculator(void) {
|
|||
|
||||
eth.fireRise(5);
|
||||
assertEqualsM("queue size 6", 2, engine->executor.size());
|
||||
assertEqualsM("6/0", start + 40944, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM("6/1", start + 41444, schedulingQueue.getForUnitText(1)->momentX);
|
||||
assertEqualsM("6/0", start + 40944, engine->executor.getForUnitTest(0)->momentX);
|
||||
assertEqualsM("6/1", start + 41444, engine->executor.getForUnitTest(1)->momentX);
|
||||
engine->executor.clear();
|
||||
|
||||
eth.fireFall(5);
|
||||
|
@ -439,9 +439,9 @@ void testRpmCalculator(void) {
|
|||
eth.firePrimaryTriggerRise();
|
||||
assertEqualsM("queue size 8", 4, engine->executor.size());
|
||||
// todo: assert queue elements completely
|
||||
assertEqualsM("8/0", start + 53333 - 1515, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM2("8/1", start + 54277, schedulingQueue.getForUnitText(1)->momentX, 0);
|
||||
assertEqualsM2("8/2", start + 54777, schedulingQueue.getForUnitText(2)->momentX, 0);
|
||||
assertEqualsM("8/0", start + 53333 - 1515, engine->executor.getForUnitTest(0)->momentX);
|
||||
assertEqualsM2("8/1", start + 54277, engine->executor.getForUnitTest(1)->momentX, 0);
|
||||
assertEqualsM2("8/2", start + 54777, engine->executor.getForUnitTest(2)->momentX, 0);
|
||||
engine->executor.clear();
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue