unitest.h file
Register and run a list of tests.
TEST_ adds a display name, tags, and a function to test_ before main. run_ runs that list, prints each failure and the pass count, and returns the number of failures.
Classes
- struct TestNode
- One registered test.
Functions
- static auto run_tests(void) -> int
- Function to run all registered tests.
Variables
Defines
- #define PRINT_TEST_PASS(name, tags)
- #define PRINT_TEST_FAIL(name, tags)
- #define TEST_CASE(name, tags)
- Register a test and open its function body.
Function documentation
static int run_tests(void)
Function to run all registered tests.
| Returns | Returns the number of failures (0 for success) |
|---|
Define documentation
#define TEST_CASE(name, tags)
Register a test and open its function body.
| Parameters | |
|---|---|
| name | Identifier used as the display name. |
| tags | String literal of filter tags, for example "[arena]". |
The next brace block is the test. name is pasted into the function, so it must be an identifier.