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