* support/regression/fwk/include/testfwk.h,
[fw/sdcc] / support / regression / fwk / include / testfwk.h
1 #ifndef __TESTFWK_H
2 #define __TESTFWK_H   1
3
4 extern int __numTests;
5 extern const int __numCases;
6
7 #ifndef NO_VARARGS
8 void __printf(const char *szFormat, ...);
9 #define LOG(_a)     __printf _a
10 #else
11 #define LOG(_a)     /* hollow log */
12 #endif
13
14 void __fail(const char *szMsg, const char *szCond, const char *szFile, int line);
15 void __prints(const char *s);
16 void __printn(int n);
17 const char *__getSuiteName(void);
18 void __runSuite(void);
19
20 #define ASSERT(_a)  (__numTests++, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__))
21 #define FAIL()      FAILM("Failure")
22 #define FAILM(_a)   __fail(_a, #_a, __FILE__, __LINE__)
23
24 #define NULL  0
25
26 #define UNUSED(_a)  if (_a) { }
27
28 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
29 # define idata
30 # define pdata
31 # define xdata
32 # define code
33 #endif
34
35 #if defined(SDCC_hc08)
36 # define idata data
37 # define pdata data
38 #endif
39
40 #if defined(SDCC_pic16)
41 # define idata data
42 # define xdata data
43 #endif
44
45 #endif