#include <stdlib.h>
#include <htils/arena.h>
#include <htils/basictypes.h>
Go to the source code of this file.
◆ COLOR_CYAN
| #define COLOR_CYAN "\x1b[36m" |
◆ COLOR_GREEN
| #define COLOR_GREEN "\x1b[32m" |
◆ COLOR_RED
| #define COLOR_RED "\x1b[31m" |
◆ COLOR_RESET
| #define COLOR_RESET "\x1b[0m" |
◆ HTILS_TEST
The test macro for test declarations.
◆ HTILS_TEST_ASSERT
| #define HTILS_TEST_ASSERT |
( |
|
cond, |
|
|
|
msg |
|
) |
| |
Value: do { \
if (!(cond)) { \
__FILE__, __LINE__, msg); \
return (msg); \
} \
} while (0)
#define COLOR_RESET
Definition test.h:16
#define COLOR_RED
Definition test.h:15
The test assertion, basically signals if condition is false, the test fails.
◆ HTILS_TEST_PASS
| #define HTILS_TEST_PASS null |
Lil macro that makes test passes more opaque
◆ HTILS_TEST_RESULT
| #define HTILS_TEST_RESULT |
( |
| ) |
|
Value: do { \
if (failures > 0) { \
fprintf(stderr,
"\n%u Tests %sFAILED%s.\n", failures,
COLOR_RED, \
return 1; \
} \
\
fprintf(stderr,
"\nAll %u tests %sPASSED%s.\n", test_count,
COLOR_GREEN, \
return 0; \
} while (0)
#define COLOR_GREEN
Definition test.h:13
Handle the test results, prints the results and returns 0 if all tests pass, returns 1 if any test fails.
◆ HTILS_TEST_RUN
| #define HTILS_TEST_RUN |
( |
|
name | ) |
|
Value: do { \
test_count++; \
fprintf(stderr, "No arena found, did you forget to initialize one?\n"); \
exit(1); \
} \
\
fprintf(stderr, "Running test: %s...\n", #name); \
\
if (!result) \
else if (result[0] == '@') \
else \
(failures)++; \
} while (0)
temp_arena_t temp_arena_new(arena_t *arena)
Create a new temp_arena.
Definition arena.c:346
#define null
Definition basictypes.h:47
char cstr
Definition basictypes.h:50
An arena.
Definition arena.h:26
A temporary arena.
Definition arena.h:39
struct arena * arena
Definition arena.h:40
#define COLOR_CYAN
Definition test.h:14
The runtime for the tests, uses temporary arenas.
◆ HTILS_TEST_SKIP
| #define HTILS_TEST_SKIP "@" |
Lil macro to tell the test suite to skip a test
◆ test_fn