aboutsummaryrefslogtreecommitdiffstats
path: root/tests/internals/test_common.h
blob: 160d9b9ad3955e66c20686139e2f5e40b9087d4b (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)());

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

#endif