diff --git a/firmware/controllers/system/event_queue.cpp b/firmware/controllers/system/event_queue.cpp index 7828291371..cfe9aa9e94 100644 --- a/firmware/controllers/system/event_queue.cpp +++ b/firmware/controllers/system/event_queue.cpp @@ -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; diff --git a/firmware/controllers/system/event_queue.h b/firmware/controllers/system/event_queue.h index fffa34d461..7ddb65c79f 100644 --- a/firmware/controllers/system/event_queue.h +++ b/firmware/controllers/system/event_queue.h @@ -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; diff --git a/unit_tests/test_signal_executor.cpp b/unit_tests/test_signal_executor.cpp index 123a1a3edd..9837e3b99c 100644 --- a/unit_tests/test_signal_executor.cpp +++ b/unit_tests/test_signal_executor.cpp @@ -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);