| 257 | } |
| 258 | |
| 259 | static void test_cronAbort() { |
| 260 | // reset X = 1 |
| 261 | // issue a task X += 2 |
| 262 | // abort task |
| 263 | // validate X = 1 |
| 264 | |
| 265 | X = 1; |
| 266 | int Y = 2; |
| 267 | AddTaskData data = _AddTaskData_New(add_task, (void *)&Y); |
| 268 | |
| 269 | // issue task X += 2 |
| 270 | CronTaskHandle task_handle = Cron_AddTask(15, _AddTaskData_Execute, NULL, |
| 271 | &data); |
| 272 | |
| 273 | // abort task |
| 274 | Cron_AbortTask(task_handle); |
| 275 | |
| 276 | // If we get here within the 0-15+ms interval, the cron thread |
| 277 | // shouldn't have yet begun the task execution. |
| 278 | TEST_ASSERT(!_AddTaskData_HasStarted(data)); |
| 279 | |
| 280 | _AddTaskData_Free(data); |
| 281 | |
| 282 | // task should have been aborted prior to its execution |
| 283 | // expecting X = 1 |
| 284 | TEST_ASSERT(X == 1); |
| 285 | } |
| 286 | |
| 287 | static void test_cronLateAbort() { |
| 288 | // reset X = 1 |
nothing calls this directly
no test coverage detected