X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=support%2Fregression%2Ffwk%2Finclude%2Ftestfwk.h;h=36a9df0979fc7c8100f439bee10a4f431b6b7d68;hb=63972d01fd5b896155742918035f3105ee48c067;hp=2f8c3225dd907a7af607b377c278222bd9737a2a;hpb=77b62b49054cb150e7d621515b920081ec6f0598;p=fw%2Fsdcc diff --git a/support/regression/fwk/include/testfwk.h b/support/regression/fwk/include/testfwk.h index 2f8c3225..36a9df09 100644 --- a/support/regression/fwk/include/testfwk.h +++ b/support/regression/fwk/include/testfwk.h @@ -2,24 +2,50 @@ #define __TESTFWK_H 1 extern int __numTests; +extern const int __numCases; -void __fail(const char *szMsg, const char *szCond, const char *szFile, int line); +#ifndef NO_VARARGS void __printf(const char *szFormat, ...); - -#define ASSERT(_a) (__numTests++, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__)) #define LOG(_a) __printf _a -#define FAIL() FAILM("Failure") -#define FAILM(_a) __fail(_a, #_a, __FILE__, __LINE__) +#else +#define LOG(_a) /* hollow log */ +#endif -typedef void (*TESTFUNP)(void); +#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) +#endif -// Provided by the suite -TESTFUNP *suite(void); +#if defined(SDCC_hc08) +# define idata data +# define pdata data +#endif -const char *getSuiteName(void); +#if defined(SDCC_pic16) +# define idata data +# define xdata 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 FAIL() FAILM("Failure") +#define FAILM(_a) __fail(_a, #_a, __FILE__, __LINE__) + +#ifndef NULL #define NULL 0 +#endif #define UNUSED(_a) if (_a) { } -#endif +#endif //__TESTFWK_H