* support/regression/fwk/testfwk.h:
[fw/sdcc] / support / regression / fwk / include / testfwk.h
index bfe3d34e89a20fb11aac62575d03b8ee33ae814c..5e9c19a356057becd5f1dc1b630b4103738ef92d 100644 (file)
@@ -11,25 +11,23 @@ void __printf(const char *szFormat, ...);
 #define LOG(_a)     /* hollow log */
 #endif
 
-void __fail(const char *szMsg, const char *szCond, const char *szFile, int line);
-void __prints(const char *s);
-void __printn(int n);
-const char *__getSuiteName(void);
-void __runSuite(void);
-
-#define ASSERT(_a)  (__numTests++, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__))
-#define FAIL()      FAILM("Failure")
-#define FAILM(_a)   __fail(_a, #_a, __FILE__, __LINE__)
-
-#define NULL  0
-
-#define UNUSED(_a)  if (_a) { }
+#ifdef SDCC
+ #include <sdcc-lib.h>
+#else
+ #define _AUTOMEM
+ #define _STATMEM
+#endif
 
 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
+# define data
 # define idata
 # define pdata
 # define xdata
 # define code
+# define near
+# define far
+# define at(x)
+# define reentrant
 #endif
 
 #if defined(SDCC_hc08)
@@ -40,6 +38,24 @@ void __runSuite(void);
 #if defined(SDCC_pic16)
 # define idata data
 # define xdata data
+# define pdata data
 #endif
 
+void __fail(code const char *szMsg, code const char *szCond, code const char *szFile, int line);
+void __prints(const char *s);
+void __printn(int n);
+code const char *__getSuiteName(void);
+void __runSuite(void);
+
+#define ASSERT(_a)  (++__numTests, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__))
+#define ASSERT_FAILED(_a)  (++__numTests, (_a) ? 0 : (__fail("Assertion failed", #_a, __FILE__, __LINE__), 1))
+#define FAIL()      FAILM("Failure")
+#define FAILM(_a)   __fail(_a, #_a, __FILE__, __LINE__)
+
+#ifndef NULL
+#define NULL  0
 #endif
+
+#define UNUSED(_a)  if (_a) { }
+
+#endif //__TESTFWK_H