MOS Source Code
Loading...
Searching...
No Matches
unittests.h
Go to the documentation of this file.
1#include <stdio.h>
2
3#ifdef UNITTESTS_SHORT_MSGS
4/* Short debug messages for platforms with limited memory */
5#define COMMENT(x) printf("\n----" x "----\n");
6#define TEST(x) \
7 if (!(x)) { \
8 fprintf(stderr, "FAIL: Line %d\n", __LINE__); \
9 status = 1; \
10 } else { \
11 printf("OK: Line %d\n", __LINE__); \
12 }
13
14#else
15
16/* Elaborate debug messages for normal development */
17#define COMMENT(x) printf("\n----" x "----\n");
18#define TEST(x) \
19 if (!(x)) { \
20 fprintf(stderr, "\033[31;1mFAILED:\033[22;39m %s:%d %s\n", __FILE__, __LINE__, #x); \
21 status = 1; \
22 } else { \
23 printf("\033[32;1mOK:\033[22;39m %s\n", #x); \
24 }
25#endif
26