1 /** Test framework support functions.
7 #include <tinibios.h> /* main() must see the ISR declarations */
10 /** Define this if the port's div or mod functions are broken.
11 A slow loop based method will be substituded.
13 #define BROKEN_DIV_MOD 1
15 void _putchar(char c);
19 int __div(int num, int denom)
22 while (num >= denom) {
29 int __mod(int num, int denom)
31 while (num >= denom) {
37 int __div(int num, int denom)
42 int __mod(int num, int denom)
48 static void _printn(int n)
59 _printn(__div(n, 10));
64 void __printf(const char *szFormat, ...) REENTRANT
67 va_start(ap, szFormat);
70 if (*szFormat == '%') {
71 switch (*++szFormat) {
73 char *sz = va_arg(ap, char *);
80 int i = va_arg(ap, int);
103 __fail(const char *szMsg, const char *szCond, const char *szFile, int line)
105 __printf("--- FAIL: \"%s\" on %s at %s:%u\n", szMsg, szCond, szFile, line);
112 // remove the next volatile and mcs51 will jump out of range
113 volatile TESTFUNP *cases;
116 __printf("--- Running: %s\n", getSuiteName());
121 __printf("Running %u\n", numCases);
127 __printf("--- Summary: %u/%u/%u: %u failed of %u tests in %u cases.\n",
128 __numFailures, __numTests, numCases,
129 __numFailures, __numTests, numCases