summaryrefslogtreecommitdiff
path: root/tests/runner.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner.c')
-rw-r--r--tests/runner.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/runner.c b/tests/runner.c
new file mode 100644
index 0000000..10b6625
--- /dev/null
+++ b/tests/runner.c
@@ -0,0 +1,40 @@
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
12struct module {
13 const char *name;
14 void (*run)(void);
15};
16
17static 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_buf", test_buf},
24 {"ot_ip", test_ip},
25 {"ot_accesslist", test_accesslist},
26 {NULL, NULL}};
27
28/* Run every module, or only those whose name contains argv[1] */
29int main(int argc, char **argv) {
30 const struct module *m;
31
32 for (m = modules; m->name; ++m) {
33 if (argc > 1 && !strstr(m->name, argv[1]))
34 continue;
35 test_module(m->name);
36 m->run();
37 }
38
39 return test_summary();
40}