| 65 | // ============================================ |
| 66 | |
| 67 | class ThreadSafeTest : public ::testing::Test { |
| 68 | protected: |
| 69 | void SetUp() override { |
| 70 | test_output.clear(); |
| 71 | task_execution_count = 0; |
| 72 | thread1_requests = 0; |
| 73 | thread2_requests = 0; |
| 74 | isr_requests = 0; |
| 75 | clearTaskRequestQueue(); |
| 76 | isInISRContext = false; |
| 77 | } |
| 78 | |
| 79 | void TearDown() override { |
| 80 | clearTaskRequestQueue(); |
| 81 | } |
| 82 | |
| 83 | // Helper: Run scheduler for specified duration |
| 84 | void runScheduler(Scheduler& ts, unsigned long duration_ms) { |
| 85 | unsigned long start = millis(); |
| 86 | while (millis() - start < duration_ms) { |
| 87 | ts.execute(); |
| 88 | delay(1); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | // Helper: Wait for condition with timeout |
| 93 | template<typename Condition> |
| 94 | bool waitForCondition(Condition cond, unsigned long timeout_ms) { |
| 95 | unsigned long start = millis(); |
| 96 | while (millis() - start < timeout_ms) { |
| 97 | if (cond()) return true; |
| 98 | delay(10); |
| 99 | } |
| 100 | return false; |
| 101 | } |
| 102 | }; |
| 103 | |
| 104 | // ============================================ |
| 105 | // Basic Queue Tests |
nothing calls this directly
no outgoing calls
no test coverage detected