|
Z / libzen 0.0.0
Header-only C99 library
|
Minimal header-only test runner shared by all test modules. More...
#include "zen/detail/inline.h"#include <inttypes.h>#include <stddef.h>#include <stdint.h>#include <stdio.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | zen_test_context_t |
| struct | zen_test_case_t |
Macros | |
| #define | ZEN_CHECK(context, condition) |
| #define | ZEN_CHECK_UINT(context, expected, actual) |
Typedefs | |
| typedef struct zen_test_context_t | zen_test_context_t |
| typedef void(*) | zen_test_fn_t(zen_test_context_t *const context) |
| typedef struct zen_test_case_t | zen_test_case_t |
Functions | |
| ZEN_STATIC_INLINE void | zen_test_report_failure (zen_test_context_t *const context, const char *const file, const unsigned int line, const char *const expression) |
| ZEN_STATIC_INLINE void | zen_test_report_failure_uint (zen_test_context_t *const context, const char *const file, const unsigned int line, const char *const expression, const uintmax_t expected, const uintmax_t actual) |
| ZEN_STATIC_INLINE int | zen_test_run_cases (const char *const suite, const zen_test_case_t *const cases, const size_t case_count, const char *const requested_case) |
| ZEN_STATIC_INLINE int | zen_test_main (const int argc, char *const *const argv, const char *const suite, const zen_test_case_t *const cases, const size_t case_count) |
Minimal header-only test runner shared by all test modules.
| #define ZEN_CHECK | ( | context, | |
| condition ) |
Fail the current case when condition is false.
| #define ZEN_CHECK_UINT | ( | context, | |
| expected, | |||
| actual ) |
Fail the current case when two unsigned values differ.
| typedef struct zen_test_case_t zen_test_case_t |
Name and implementation of one test case.
| typedef struct zen_test_context_t zen_test_context_t |
Mutable state for one test case; no shared globals are used.
| typedef void(*) zen_test_fn_t(zen_test_context_t *const context) |
Signature of a single test case.
| ZEN_STATIC_INLINE int zen_test_main | ( | const int | argc, |
| char *const *const | argv, | ||
| const char *const | suite, | ||
| const zen_test_case_t *const | cases, | ||
| const size_t | case_count ) |
Test executable entry point; accepts –case NAME to select one case.
| ZEN_STATIC_INLINE void zen_test_report_failure | ( | zen_test_context_t *const | context, |
| const char *const | file, | ||
| const unsigned int | line, | ||
| const char *const | expression ) |
Record a failed boolean check and print its source location.
| ZEN_STATIC_INLINE void zen_test_report_failure_uint | ( | zen_test_context_t *const | context, |
| const char *const | file, | ||
| const unsigned int | line, | ||
| const char *const | expression, | ||
| const uintmax_t | expected, | ||
| const uintmax_t | actual ) |
Record a failed integer check and print expected and actual values.
| ZEN_STATIC_INLINE int zen_test_run_cases | ( | const char *const | suite, |
| const zen_test_case_t *const | cases, | ||
| const size_t | case_count, | ||
| const char *const | requested_case ) |
Run every case, or only the case named by requested_case.