summaryrefslogtreecommitdiff
path: root/tests/main.c
blob: 7b791cde943791009d032c8e7f6d6a90950d629f (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
#include "test.h"

#include <stdarg.h>
#include <stdio.h>

static bool any_failure = false;

void test_fail(const char *fmt, ...) {
	any_failure = true;
	fprintf(stderr, "\x1b[1m\x1b[91mFailure:\x1b[0m ");
	va_list args;
	va_start(args, fmt);
	vfprintf(stderr, fmt, args);
	va_end(args);
	fprintf(stderr, "\n");
}

int main(void) {
	const char *test_dir = "../tests";
	test_parsing(test_dir);
	if (any_failure) {
		fprintf(stderr, "\x1b[1m\x1b[91mSome tests failed.\x1b[0m\n");
	} else {
		printf("\x1b[1m\x1b[92mAll tests OK\x1b[0m\n");
	}
}