CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
This file contains definitions and implementation of various unit tests for checking the functionality of the timeout.c API functions. More...
Data Structures | |
struct | CallBackUserData |
A structure to be used by the unit test callback function to signal to the test when the callback occurred and whether the callback was successful. More... | |
Functions | |
static void | TimerCallback (const CdiTimeoutCbData *data_ptr) |
A callback function to be executed when a timer expires. This function checks the time when the timer callback occurs and compares the callback time with the expected timer expiration time that was stored when the timer was originally set. If the actual time is within a specified range of the expected time then callback user data has its pass field set as true. | |
static bool | OneShotTimeoutTest (int timeout_ms) |
A test to create a timeout instance add a timer to it, let it expire and check the callback. | |
static bool | MultipleTimersTest (unsigned int num_timers, bool reverse) |
A test to set multiple timers. | |
static bool | TimersSetAndClear (uint32_t num_timers) |
A test to set multiple timers, let them expire in order and check the callback values. | |
CdiReturnStatus | TestUnitTimeout (void) |
Main routine to test the timeout function. | |
This file contains definitions and implementation of various unit tests for checking the functionality of the timeout.c API functions.
|
static |
A test to set multiple timers.
num_timers | sets how many timers are added to the timeout instance |
reverse | if true, each successive timer object has an earlier deadline as the list is built. |
Check the pass status of all of the user_data structures sent to the callback function. The callback function logged errors for additional detail into the actual failure. Checking here as well to catch any user data structures where the callback didn't occur at all.
|
static |
A test to create a timeout instance add a timer to it, let it expire and check the callback.
timeout_ms | is a timeout to set for the created timer |
CdiReturnStatus TestUnitTimeout | ( | void | ) |
Main routine to test the timeout function.
External declarations.
|
static |
A callback function to be executed when a timer expires. This function checks the time when the timer callback occurs and compares the callback time with the expected timer expiration time that was stored when the timer was originally set. If the actual time is within a specified range of the expected time then callback user data has its pass field set as true.
data_ptr | is a pointer to the CdiTimeoutCbData that is used for timeout callbacks. This structure contains a user data pointer to CallBackUserData which stores the expected expiration time and the pass signal that was mentioned above |
|
static |
A test to set multiple timers, let them expire in order and check the callback values.
num_timers | sets how many timers to add and remove from the timeout instance |