auto-sync

This commit is contained in:
rusEfi 2015-04-17 11:04:27 -04:00
parent 96bbd2741a
commit 25b98d0ffd
3 changed files with 15 additions and 1 deletions

View File

@ -136,6 +136,10 @@ void EventQueue::setLateDelay(int value) {
lateDelay = value;
}
scheduling_s * EventQueue::getHead() {
return head;
}
scheduling_s *EventQueue::getForUnitText(int index) {
scheduling_s * current;

View File

@ -52,6 +52,7 @@ public:
int size(void);
scheduling_s *getForUnitText(int index);
void setLateDelay(int value);
scheduling_s * getHead();
private:
bool checkIfPending(scheduling_s *scheduling);
scheduling_s *head;

View File

@ -92,13 +92,22 @@ void testSignalExecutor(void) {
scheduling_s s1;
scheduling_s s2;
scheduling_s s3;
scheduling_s s4;
eq.insertTask(&s1, 10, callback, NULL);
eq.insertTask(&s4, 10, callback, NULL);
eq.insertTask(&s2, 11, callback, NULL);
eq.insertTask(&s3, 12, callback, NULL);
assertEquals(4, eq.size());
assertEquals(12, eq.getHead()->momentX);
assertEquals(11, eq.getHead()->next->momentX);
assertEquals(10, eq.getHead()->next->next->momentX);
assertEquals(10, eq.getHead()->next->next->next->momentX);
callbackCounter = 0;
eq.executeAll(10);
assertEquals(1, callbackCounter);
assertEqualsM("callbackCounter", 2, callbackCounter);
callbackCounter = 0;
eq.executeAll(11);
assertEquals(1, callbackCounter);