|
Z / libzlang 0.29.0
C99 runtime library and the Zlang 0.29 source-to-source compiler
|
Minimal header-only test runner shared by all test modules. More...
#include "zlang/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 | zlang_test_context_t |
| struct | zlang_test_case_t |
Macros | |
| #define | ZLANG_CHECK(context, condition) |
| #define | ZLANG_CHECK_UINT(context, expected, actual) |
Typedefs | |
| typedef struct zlang_test_context_t | zlang_test_context_t |
| typedef void(*) | zlang_test_fn_t(zlang_test_context_t *const context) |
| typedef struct zlang_test_case_t | zlang_test_case_t |
Functions | |
| ZLANG_STATIC_INLINE void | zlang_test_report_failure (zlang_test_context_t *const context, const char *const file, const unsigned int line, const char *const expression) |
| ZLANG_STATIC_INLINE void | zlang_test_report_failure_uint (zlang_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) |
| ZLANG_STATIC_INLINE int | zlang_test_run_cases (const char *const suite, const zlang_test_case_t *const cases, const size_t case_count, const char *const requested_case) |
| ZLANG_STATIC_INLINE int | zlang_test_main (const int argc, char *const *const argv, const char *const suite, const zlang_test_case_t *const cases, const size_t case_count) |
Minimal header-only test runner shared by all test modules.
| #define ZLANG_CHECK | ( | context, | |
| condition ) |
Fail the current case when condition is false.
| #define ZLANG_CHECK_UINT | ( | context, | |
| expected, | |||
| actual ) |
Fail the current case when two unsigned values differ.
| typedef struct zlang_test_case_t zlang_test_case_t |
Name and implementation of one test case.
| typedef struct zlang_test_context_t zlang_test_context_t |
Mutable state for one test case; no shared globals are used.
| typedef void(*) zlang_test_fn_t(zlang_test_context_t *const context) |
Signature of a single test case.
| ZLANG_STATIC_INLINE int zlang_test_main | ( | const int | argc, |
| char *const *const | argv, | ||
| const char *const | suite, | ||
| const zlang_test_case_t *const | cases, | ||
| const size_t | case_count ) |
Test executable entry point; accepts –case NAME to select one case.
| ZLANG_STATIC_INLINE void zlang_test_report_failure | ( | zlang_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.
| ZLANG_STATIC_INLINE void zlang_test_report_failure_uint | ( | zlang_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.
| ZLANG_STATIC_INLINE int zlang_test_run_cases | ( | const char *const | suite, |
| const zlang_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.