Add helper macro for running test functions
This commit is contained in:
parent
7fb13f2439
commit
75bbb82058
@ -8,6 +8,7 @@ extern "C" {
|
|||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#define TEST_RESULT(BOOL) ((TestFuncResult){.name = __func__, .success = BOOL})
|
#define TEST_RESULT(BOOL) ((TestFuncResult){.name = __func__, .success = BOOL})
|
||||||
|
#define RUN_TEST_FUNCS(...) run_tests(__VA_ARGS__, NULL)
|
||||||
|
|
||||||
typedef struct test_func_result TestFuncResult;
|
typedef struct test_func_result TestFuncResult;
|
||||||
struct test_func_result {
|
struct test_func_result {
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
run_tests(test_arena_init, test_arena_alloc_succeeds_when_within_capacity,
|
RUN_TEST_FUNCS(test_arena_init,
|
||||||
test_arena_alloc_fails_when_over_capacity, test_arena_clear,
|
test_arena_alloc_succeeds_when_within_capacity,
|
||||||
test_arena_destroy);
|
test_arena_alloc_fails_when_over_capacity, test_arena_clear,
|
||||||
|
test_arena_destroy);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user