37 CHECK_TEXT(
false,
"expecting assertion when empty");
56 CHECK_EQUAL(0, strategy->
GetSize());
59 CHECK_EQUAL(0, strategy->
GetNext());
75 CHECK_TEXT(
false,
"expecting assertion - OnTaskDeadlineMissed not supported");
101 CHECK_EQUAL_TEXT(&task1, first->
GetUserTask(),
"expecting first task1");
104 CHECK_EQUAL_TEXT(&task1, next->
GetUserTask(),
"expecting next task1");
107 CHECK_EQUAL_TEXT(&task2, next->
GetUserTask(),
"expecting next task2");
110 CHECK_EQUAL_TEXT(&task3, next->
GetUserTask(),
"expecting next task3");
113 CHECK_EQUAL_TEXT(&task1, next->
GetUserTask(),
"expecting next task1 again (endless looping)");
116 CHECK_EQUAL_TEXT(&task2, next->
GetUserTask(),
"expecting next task2 again (endless looping)");
121 CHECK_EQUAL_TEXT(&task3, next->
GetUserTask(),
"expecting next task3 again (endless looping)");
124 CHECK_EQUAL_TEXT(&task1, next->
GetUserTask(),
"expecting next task1 again (endless looping)");
145 for (int32_t i = 0; i < 5; i++)
148 CHECK_EQUAL_TEXT(&task1, next->
GetUserTask(),
"Single task must always be selected");
156 CHECK_EQUAL_TEXT(&task1, next->
GetUserTask(),
"Next task should be task1");
158 CHECK_EQUAL_TEXT(&task2, next->
GetUserTask(),
"Next task should be task2");
160 CHECK_EQUAL_TEXT(&task1, next->
GetUserTask(),
"Next task should wrap to task1");
168 CHECK_EQUAL_TEXT(&task2, next->
GetUserTask(),
"Next task should be task2");
170 CHECK_EQUAL_TEXT(&task3, next->
GetUserTask(),
"Next task should be task3");
172 CHECK_EQUAL_TEXT(&task1, next->
GetUserTask(),
"Next task should wrap to task1");
180 CHECK_EQUAL_TEXT(&task3, next->
GetUserTask(),
"Next task should be task3 after removal");
182 CHECK_EQUAL_TEXT(&task1, next->
GetUserTask(),
"Next task should be task1 after removal");
184 CHECK_EQUAL_TEXT(&task3, next->
GetUserTask(),
"Next task should wrap to task3");
Namespace of STK package.
SwitchStrategyRoundRobin SwitchStrategyRR
Shorthand alias for SwitchStrategyRoundRobin.
Namespace of the test inventory.
TestContext g_TestContext
Global instance of the TestContext.
Concrete implementation of IKernel.
void Initialize(uint32_t resolution_us=PERIODICITY_DEFAULT)
Prepare kernel for use: reset state, configure the platform, and register the service singleton.
ITaskSwitchStrategy * GetSwitchStrategy()
Get task-switching strategy instance owned by this kernel.
void RemoveTask(ITask *user_task)
Remove a previously added task from the kernel before Start().
void AddTask(ITask *user_task)
Register task for a soft real-time (SRT) scheduling.
Scheduling-strategy-facing interface for a kernel task slot.
virtual ITask * GetUserTask()=0
Get user task.
Interface for a task switching strategy implementation.
virtual size_t GetSize() const =0
Get number of tasks currently managed by this strategy.
virtual IKernelTask * GetNext()=0
Advance the internal iterator and return the next runnable task.
virtual IKernelTask * GetFirst() const =0
Get first task.
virtual bool OnTaskDeadlineMissed(IKernelTask *task)=0
Notification that a task has exceeded its HRT deadline; returns whether the strategy can recover with...
Round-Robin task-switching strategy: each runnable task receives one time slice (one tick interval) i...
IKernelTask * GetFirst() const
Get first task in the managed set (used by the kernel for initial scheduling).
Throwable class for catching assertions from STK_ASSERT_HANDLER().