You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.0 KiB
76 lines
2.0 KiB
#include <cl_io.h>
|
|
|
|
#define ASSERT(expr) \
|
|
if (!(expr)) { \
|
|
fprint(cl_stderr,"Assertion failed! File "); \
|
|
fprint(cl_stderr,__FILE__); \
|
|
fprint(cl_stderr,", line "); \
|
|
fprintdecimal(cl_stderr,__LINE__); \
|
|
fprint(cl_stderr,".\n"); \
|
|
error = 1; \
|
|
}
|
|
|
|
#define ASSERT1(expr,a) \
|
|
if (!(expr)) { \
|
|
fprint(cl_stderr,"Assertion failed! File "); \
|
|
fprint(cl_stderr,__FILE__); \
|
|
fprint(cl_stderr,", line "); \
|
|
fprintdecimal(cl_stderr,__LINE__); \
|
|
fprint(cl_stderr,".\n"); \
|
|
fprint(cl_stderr,#a" = "); \
|
|
fprint(cl_stderr,a); \
|
|
fprint(cl_stderr,"\n"); \
|
|
error = 1; \
|
|
}
|
|
|
|
#define ASSERT2(expr,a,b) \
|
|
if (!(expr)) { \
|
|
fprint(cl_stderr,"Assertion failed! File "); \
|
|
fprint(cl_stderr,__FILE__); \
|
|
fprint(cl_stderr,", line "); \
|
|
fprintdecimal(cl_stderr,__LINE__); \
|
|
fprint(cl_stderr,".\n"); \
|
|
fprint(cl_stderr,#a" = "); \
|
|
fprint(cl_stderr,a); \
|
|
fprint(cl_stderr,"\n"#b" = "); \
|
|
fprint(cl_stderr,b); \
|
|
fprint(cl_stderr,"\n"); \
|
|
error = 1; \
|
|
}
|
|
|
|
#define ASSERT3(expr,a,b,c) \
|
|
if (!(expr)) { \
|
|
fprint(cl_stderr,"Assertion failed! File "); \
|
|
fprint(cl_stderr,__FILE__); \
|
|
fprint(cl_stderr,", line "); \
|
|
fprintdecimal(cl_stderr,__LINE__); \
|
|
fprint(cl_stderr,".\n"); \
|
|
fprint(cl_stderr,#a" = "); \
|
|
fprint(cl_stderr,a); \
|
|
fprint(cl_stderr,"\n"#b" = "); \
|
|
fprint(cl_stderr,b); \
|
|
fprint(cl_stderr,"\n"#c" = "); \
|
|
fprint(cl_stderr,c); \
|
|
fprint(cl_stderr,"\n"); \
|
|
error = 1; \
|
|
}
|
|
|
|
#define ASSERT4(expr,a,b,c,d) \
|
|
if (!(expr)) { \
|
|
fprint(cl_stderr,"Assertion failed! File "); \
|
|
fprint(cl_stderr,__FILE__); \
|
|
fprint(cl_stderr,", line "); \
|
|
fprintdecimal(cl_stderr,__LINE__); \
|
|
fprint(cl_stderr,".\n"); \
|
|
fprint(cl_stderr,#a" = "); \
|
|
fprint(cl_stderr,a); \
|
|
fprint(cl_stderr,"\n"#b" = "); \
|
|
fprint(cl_stderr,b); \
|
|
fprint(cl_stderr,"\n"#c" = "); \
|
|
fprint(cl_stderr,c); \
|
|
fprint(cl_stderr,"\n"#d" = "); \
|
|
fprint(cl_stderr,d); \
|
|
fprint(cl_stderr,"\n"); \
|
|
error = 1; \
|
|
}
|
|
|