From f24ec48b27d4cb8dd0555840206dedbb45f1423c Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 24 Oct 2026 01:17:50 +0200 Subject: Add a unit test harness and a first set of tests make check builds tests/runner from the modules that link without the io subsystem and runs it. --- tests/runner.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/runner.c (limited to 'tests/runner.c') diff --git a/tests/runner.c b/tests/runner.c new file mode 100644 index 0000000..d73c516 --- /dev/null +++ b/tests/runner.c @@ -0,0 +1,34 @@ +/* This software was written by Dirk Engling + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ + +/* System */ +#include + +/* Opentracker */ +#include "test.h" + +struct module { + const char *name; + void (*run)(void); +}; + +static const struct module modules[] = {{"scan_urlencoded_query", test_scan_urlencoded_query}, + {"ot_iovec", test_iovec}, + {"ot_vector", test_vector}, + {NULL, NULL}}; + +/* Run every module, or only those whose name contains argv[1] */ +int main(int argc, char **argv) { + const struct module *m; + + for (m = modules; m->name; ++m) { + if (argc > 1 && !strstr(m->name, argv[1])) + continue; + test_module(m->name); + m->run(); + } + + return test_summary(); +} -- cgit v1.3