summaryrefslogtreecommitdiff
path: root/tests/runner.c
blob: d73c51690f82e134a2d9cef870da9ff7f73ac89b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
   It is considered beerware. Prost. Skol. Cheers or whatever.

   $id$ */

/* System */
#include <string.h>

/* 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();
}