1 /** Test framework support functions.
7 #include <tinibios.h> /* main() must see the ISR declarations */
10 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
13 #define _REENTRANT reentrant
16 #if defined(SDCC_mcs51)
17 /* until changed, isr's must have a prototype in the module containing main */
18 void T2_isr (void) interrupt 5;
21 /** Define this if the port's div or mod functions are broken.
22 A slow loop based method will be substituded.
24 //#define BROKEN_DIV_MOD 1
26 void _putchar(char c);
30 int __div(int num, int denom)
33 while (num >= denom) {
40 int __mod(int num, int denom)
42 while (num >= denom) {
48 int __div(int num, int denom)
53 int __mod(int num, int denom)
59 static void _printn(int n) _REENTRANT
70 _printn(__div(n, 10));
75 void __printf(const char *szFormat, ...) REENTRANT
78 va_start(ap, szFormat);
81 if (*szFormat == '%') {
82 switch (*++szFormat) {
84 char *sz = va_arg(ap, char *);
91 int i = va_arg(ap, int);
114 __fail(const char *szMsg, const char *szCond, const char *szFile, int line)
116 __printf("--- FAIL: \"%s\" on %s at %s:%u\n", szMsg, szCond, szFile, line);
126 __printf("--- Running: %s\n", getSuiteName());
131 __printf("Running %u\n", numCases);
137 __printf("--- Summary: %u/%u/%u: %u failed of %u tests in %u cases.\n",
138 __numFailures, __numTests, numCases,
139 __numFailures, __numTests, numCases