diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2024-07-22 14:32:29 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2024-07-22 14:32:29 -0400 |
| commit | 337ffc577ad20a457b086dee8b3af8bcde8c2881 (patch) | |
| tree | 5104d9d1edde117667608e0e1c924a6368786e92 /eztester.h | |
| parent | da6877b8be4ecd6a27e076766bf0b6b6f02959cd (diff) | |
run tests in a separate process
Diffstat (limited to 'eztester.h')
| -rw-r--r-- | eztester.h | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -3,12 +3,17 @@ #include <stddef.h> #include <stdio.h> -// possible results of a test +// possible results of a test. // error is always fatal -typedef enum { TEST_PASS, TEST_FAIL, TEST_WARNING, TEST_ERROR } eztester_status; +typedef enum { TEST_PASS, TEST_WARNING, TEST_FAIL, TEST_ERROR } eztester_status; +/* how eztester should behave when encountering a non passing test. + * + * EXIT_ON_WARNING implies EXIT_ON_FAIL + */ typedef enum { EXIT_ON_WARNING, CONTINUE_ALL, EXIT_ON_FAIL } eztester_behavior; +// a single individual test to be ran typedef eztester_status(eztester_runner)(); typedef struct { @@ -22,13 +27,22 @@ typedef struct { size_t capacity; } eztester_list; +// create a list with a given capacity eztester_list *eztester_create_list(const size_t capacity); +/* add a test to a list. + * the same test can be registered multiple times. + * will resize the list as necessary + */ void eztester_register(eztester_list *test_list, const eztester_test new_test); -void eztester_run(eztester_list *test_list, const eztester_behavior behavior); +// remove all tests from a list but do not free the list itself void eztester_clear_list(eztester_list *test_list); +// clears a list and free's the list void eztester_destroy_list(eztester_list *test_list); -void eztester_test_print(const char *format, ...); +// print during a test +void eztester_test_print(const char *__restrict format, ...); +// run all tests with a list with a given behavior +void eztester_run(eztester_list *test_list, const eztester_behavior behavior); /* Run a shell script found at file_path, it can read in from input and write to * output |
