aboutsummaryrefslogtreecommitdiff
path: root/test/test-internal.h
blob: 78f5e7bf6982fc52de98931485cc70b4d26b4022 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef ORYX_TEST_INTERNAL_H
#define ORYX_TEST_INTERNAL_H

#include <stdio.h>
#include <stdlib.h>

static int rv;

#define oryx_assert(expr)                                                      \
	do {                                                                       \
		if (!(expr)) {                                                         \
			fprintf(stderr, "%s:%d: Test ‘%s’ failed\n", __FILE__, __LINE__,   \
			        __func__);                                                 \
			fprintf(stderr, "\tFailing expression: ‘%s’\n", #expr);            \
			rv = EXIT_FAILURE;                                                 \
			goto cleanup;                                                      \
		}                                                                      \
	} while (0)

#endif /* !ORYX_TEST_INTERNAL_H */