23static char test_output[20];
24static uint8_t executions;
26static void test_handler (
void * p_event_data, uint16_t event_size)
28 memcpy (test_output, p_event_data, event_size);
45 printfp (
"\"init\":");
91 printfp (
"\"fail\",\r\n");
95 printfp (
"\"pass\",\r\n");
117 char test_input[] =
"Hello scheduler";
118 printfp (
"\"execute\":");
125 if (
RD_SUCCESS != err_code || strcmp (test_output, test_input) || (3 != executions))
128 printfp (
"\"fail\",\r\n");
132 printfp (
"\"pass\",\r\n");
149 printfp (
"\"put\":");
156 for (
size_t ii = 0; ii <= RI_SCHEDULER_LENGTH; ii++)
192 printfp (
"\"fail\"\r\n");
196 printfp (
"\"pass\"\r\n");
204 printfp (
"\"scheduler\":{\r\n");
206 status |= ri_scheduler_init_test (printfp);
207 status |= ri_scheduler_execute_test (printfp);
208 status |= ri_scheduler_event_put_test (printfp);
#define RD_ERROR_NULL
Null Pointer.
uint32_t rd_status_t
bitfield for representing errors
#define RD_ERROR_INVALID_LENGTH
Invalid Length.
#define RD_SUCCESS
Internal Error.
#define RD_ERROR_NO_MEM
No Memory for operation.
#define RD_ERROR_INVALID_STATE
Invalid state, operation disallowed in this state.
rd_status_t ri_scheduler_event_put(const void *const p_event_data, const uint16_t event_size, const ruuvi_scheduler_event_handler_t handler)
Schedule given task to be executed on next call to ri_scheduler_execute.
bool ri_scheduler_run_integration_test(const rd_test_print_fp printfp)
Run all scheduler integration tests.
rd_status_t ri_scheduler_execute(void)
Executes all scheduled tasks.
bool ri_scheduler_is_init(void)
Check if scheduler is initialized.
rd_status_t ri_scheduler_init(void)
Enable implementation selected by application.
rd_status_t ri_scheduler_uninit(void)
Uninitialize scheduler.
void(* rd_test_print_fp)(const char *const msg)
function pointer to print test information
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
Interface functions to scheduler.
Test interface functions to scheduler.