2016-11-13 12:37:22 +00:00
|
|
|
#include "test.h"
|
|
|
|
|
2016-11-16 19:50:14 +00:00
|
|
|
/* No CRT in this file (this includes stdio and stdlib!). */
|
|
|
|
|
2016-11-13 12:37:22 +00:00
|
|
|
void finished(void)
|
|
|
|
{
|
|
|
|
static const char s[] = "@@FINISHED\n";
|
|
|
|
write(1, s, sizeof(s));
|
2016-11-26 10:56:17 +00:00
|
|
|
_exit(0);
|
2016-11-13 12:37:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void writehex(uint32_t code)
|
|
|
|
{
|
|
|
|
char buf[8];
|
2016-11-16 19:50:14 +00:00
|
|
|
char* p = &buf[sizeof(buf)];
|
2016-11-13 12:37:22 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
*--p = "0123456789abcdef"[code & 0xf];
|
|
|
|
code >>= 4;
|
|
|
|
}
|
|
|
|
while (code > 0);
|
|
|
|
|
2016-11-16 19:50:14 +00:00
|
|
|
write(1, p, buf + sizeof(buf) - p);
|
2016-11-13 12:37:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void fail(uint32_t code)
|
|
|
|
{
|
2016-11-26 10:23:25 +00:00
|
|
|
write(1, "@@FAIL 0x", 10);
|
2016-11-13 12:37:22 +00:00
|
|
|
writehex(code);
|
|
|
|
write(1, "\n", 1);
|
|
|
|
}
|