summaryrefslogtreecommitdiffstats
path: root/src/test.h
blob: 443328dcd10fa737cd2ddceedfe83bf2e4595461 (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
29

#ifndef TEST_H
#define TEST_H

#include <stdio.h>
#include "intf.h"
#include "debug.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 */