about summary refs log tree commit diff stats
path: root/test/src/main.c
blob: e8a03510b871f1720c47e1cfedd5b8f53aadd645 (plain) (blame)
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
35
36
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include "test-list.h"

/* TODO(indutny): TAP */

#define TEST_SELECT(N)                                                        \
    if (strncmp(argv[1], #N, sizeof(#N) - 1) == 0) {                          \
      fprintf(stderr, "===== " #N " =====\n");                                \
      TEST_FN(N)();                                                           \
      return 0;                                                               \
    }

/* TODO(indutny): fork and run */

#define TEST_RUN(N)                                                           \
    do {                                                                      \
      fprintf(stderr, "===== " #N " =====\n");                                \
      TEST_FN(N)();                                                           \
    } while (0);

int main(int argc, char** argv) {
  if (argc == 2) {
    TEST_ENUM(TEST_SELECT)

    return -1;
  }

  TEST_ENUM(TEST_RUN)

  return 0;
}

#undef TEST_SELECT