summaryrefslogtreecommitdiffstats
path: root/src/test.h
blob: 18e8807702e0c94eddcfa5175c10dcf4d76f1a23 (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
27
28

#ifndef TEST_H
#define TEST_H

#include <stdio.h>
#include "intf.h"

extern int assert_debug;

#define TEST_ASSERT(cond, out_label) \
do { \
	if (assert_debug) \
		printf("  ASSERT '" #cond "' ... "); \
	if (tsnif_debug) \
		printf("\n"); \
	if (!(cond)) { \
		rc = -1; \
		printf("FAILED\n"); \
		if (assert_debug) \
			printf("  ^^^^^^ %s:%d function %s\n",\
				__FILE__, __LINE__, __FUNCTION__); \
		goto out_label; \
	} \
	if (assert_debug) \
		printf("OK\n"); \
} while(0)

#endif /* TEST_H */