Files | |
| file | expect.h | 
| test "expect condition" utility function  | |
Macros | |
| #define | expect(cond) (likely(cond) ? (void)0 : _expect_failure(__FILE__, __LINE__)) | 
| abort the program if condition is false  More... | |
Functions | |
| static NORETURN void | _expect_failure (const char *file, unsigned line) | 
| Function to handle failed expectation.  More... | |
| #define expect | ( | cond | ) | (likely(cond) ? (void)0 : _expect_failure(__FILE__, __LINE__)) | 
abort the program if condition is false
This is similar to assert(), but will not be excluded from a build even if NDEBUG is set. Use e.g., in test application to "assert" conditions, in order to prevent a different compilation mode (a release build?) from making the test non-functional.
Otherwise, the macro expect() prints an error message to standard error and terminates the application by calling core_panic().
The purpose of this macro is to help programmers find bugs in their programs.
A failed condition generates output similar to:
0x89abcdef *** RIOT kernel panic: FAILED CONDITION. ...
 Where 0x89abcdef is an address. This address can be used with tools like addr2line (or e.g. arm-none-eabi-addr2line for ARM-based code), objdump, or gdb (with the command info line *(0x89abcdef)) to identify the line the condition failed in. 
      
  | 
  inlinestatic | 
Function to handle failed expectation.
| [in] | file | The file name of the file the expectation failed in | 
| [in] | line | The code line of file the expectation failed in  |