aboutsummaryrefslogtreecommitdiffstats
path: root/tests/internals/test_common.h
blob: 055fc3845c2276889e7ee6e1e749895f7ef82009 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#ifndef INC_BINDFS_TEST_COMMON_H
#define INC_BINDFS_TEST_COMMON_H

#include <stdio.h>
#include <math.h>

extern int failures;

#define TEST_ASSERT(expr) do { if (!(expr)) { printf("Assertion failed: %s:%d: `%s'\n", __FILE__, __LINE__, #expr); ++failures; } } while (0);
#define NEAR(a, b, eps) (fabs((a) - (b)) < (eps))

int run_suite(void (*suite)(void));

#define TEST_MAIN(suite) int main(void) { return run_suite(suite); }

#endif