diff options
Diffstat (limited to 'tests/runner.c')
| -rw-r--r-- | tests/runner.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/runner.c b/tests/runner.c new file mode 100644 index 0000000..370b92b --- /dev/null +++ b/tests/runner.c | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* This software was written by Dirk Engling <erdgeist@erdgeist.org> | ||
| 2 | It is considered beerware. Prost. Skol. Cheers or whatever. | ||
| 3 | |||
| 4 | $id$ */ | ||
| 5 | |||
| 6 | /* System */ | ||
| 7 | #include <string.h> | ||
| 8 | |||
| 9 | /* Opentracker */ | ||
| 10 | #include "test.h" | ||
| 11 | |||
| 12 | struct module { | ||
| 13 | const char *name; | ||
| 14 | void (*run)(void); | ||
| 15 | }; | ||
| 16 | |||
| 17 | static const struct module modules[] = {{"scan_urlencoded_query", test_scan_urlencoded_query}, | ||
| 18 | {"ot_iovec", test_iovec}, | ||
| 19 | {"ot_vector", test_vector}, | ||
| 20 | {"ot_random", test_random}, | ||
| 21 | {"ot_hex", test_hex}, | ||
| 22 | {"ot_scan", test_scan}, | ||
| 23 | {"ot_accesslist", test_accesslist}, | ||
| 24 | {NULL, NULL}}; | ||
| 25 | |||
| 26 | /* Run every module, or only those whose name contains argv[1] */ | ||
| 27 | int main(int argc, char **argv) { | ||
| 28 | const struct module *m; | ||
| 29 | |||
| 30 | for (m = modules; m->name; ++m) { | ||
| 31 | if (argc > 1 && !strstr(m->name, argv[1])) | ||
| 32 | continue; | ||
| 33 | test_module(m->name); | ||
| 34 | m->run(); | ||
| 35 | } | ||
| 36 | |||
| 37 | return test_summary(); | ||
| 38 | } | ||
