41689935db2750916b186826a3ca35097c14150c
[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 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
15 # define data
16 # define idata
17 # define pdata
18 # define xdata
19 # define code
20 # define near
21 # define far
22 # define at(x)
23 #endif
24
25 #if defined(SDCC_hc08)
26 # define idata data
27 # define pdata data
28 #endif
29
30 #if defined(SDCC_pic16)
31 # define idata data
32 # define xdata data
33 #endif
34
35 void __fail(code const char *szMsg, code const char *szCond, code const char *szFile, int line);
36 void __prints(const char *s);
37 void __printn(int n);
38 code const char *__getSuiteName(void);
39 void __runSuite(void);
40
41 #define ASSERT(_a)  (__numTests++, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__))
42 #define FAIL()      FAILM("Failure")
43 #define FAILM(_a)   __fail(_a, #_a, __FILE__, __LINE__)
44
45 #define NULL  0
46
47 #define UNUSED(_a)  if (_a) { }
48
49 #endif //__TESTFWK_H