* src/*/ralloc.c: removed IS_OP_RUONLY macro
[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 #ifdef SDCC
15  #include <sdcc-lib.h>
16 #else
17  #define _AUTOMEM
18  #define _STATMEM
19 #endif
20
21 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
22 # define data
23 # define idata
24 # define pdata
25 # define xdata
26 # define code
27 # define near
28 # define far
29 # define at(x)
30 #endif
31
32 #if defined(SDCC_hc08)
33 # define idata data
34 # define pdata data
35 #endif
36
37 #if defined(SDCC_pic16)
38 # define idata data
39 # define xdata data
40 #endif
41
42 void __fail(code const char *szMsg, code const char *szCond, code const char *szFile, int line);
43 void __prints(const char *s);
44 void __printn(int n);
45 code const char *__getSuiteName(void);
46 void __runSuite(void);
47
48 #define ASSERT(_a)  (++__numTests, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__))
49 #define ASSERT_FAILED(_a)  (++__numTests, (_a) ? 0 : (__fail("Assertion failed", #_a, __FILE__, __LINE__), 1))
50 #define FAIL()      FAILM("Failure")
51 #define FAILM(_a)   __fail(_a, #_a, __FILE__, __LINE__)
52
53 #ifndef NULL
54 #define NULL  0
55 #endif
56
57 #define UNUSED(_a)  if (_a) { }
58
59 #endif //__TESTFWK_H