Imported Upstream version 2.9.0
[debian/cc1111] / 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 # define reentrant
31 #endif
32
33 #if defined(SDCC_hc08)
34 # define idata data
35 # define pdata data
36 #endif
37
38 #if defined(SDCC_pic16)
39 # define idata data
40 # define xdata data
41 # define pdata data
42 #endif
43
44 void __fail(code const char *szMsg, code const char *szCond, code const char *szFile, int line);
45 void __prints(const char *s);
46 void __printn(int n);
47 code const char *__getSuiteName(void);
48 void __runSuite(void);
49
50 #define ASSERT(_a)  (++__numTests, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__))
51 #define ASSERT_FAILED(_a)  (++__numTests, (_a) ? 0 : (__fail("Assertion failed", #_a, __FILE__, __LINE__), 1))
52 #define FAIL()      FAILM("Failure")
53 #define FAILM(_a)   __fail(_a, #_a, __FILE__, __LINE__)
54
55 #ifndef NULL
56 #define NULL  0
57 #endif
58
59 #define UNUSED(_a)  if (_a) { }
60
61 #endif //__TESTFWK_H