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 /** Define this if the port's div or mod functions are broken.
17 A slow loop based method will be substituded.
19 //#define BROKEN_DIV_MOD 1
21 void _putchar(char c);
25 int __div(int num, int denom)
28 while (num >= denom) {
35 int __mod(int num, int denom)
37 while (num >= denom) {
43 int __div(int num, int denom)
48 int __mod(int num, int denom)
54 static void _printn(int n) _REENTRANT
65 _printn(__div(n, 10));
70 void __printf(const char *szFormat, ...) REENTRANT
73 va_start(ap, szFormat);
76 if (*szFormat == '%') {
77 switch (*++szFormat) {
79 char *sz = va_arg(ap, char *);
86 int i = va_arg(ap, int);
109 __fail(const char *szMsg, const char *szCond, const char *szFile, int line)
111 __printf("--- FAIL: \"%s\" on %s at %s:%u\n", szMsg, szCond, szFile, line);
121 __printf("--- Running: %s\n", getSuiteName());
126 __printf("Running %u\n", numCases);
132 __printf("--- Summary: %u/%u/%u: %u failed of %u tests in %u cases.\n",
133 __numFailures, __numTests, numCases,
134 __numFailures, __numTests, numCases