2019-06-13 16:09:05 +01:00
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define require(test) \
|
|
|
|
do { \
|
|
|
|
if(!(test)) { \
|
2019-08-05 13:02:10 +01:00
|
|
|
printf("failed:\n\t%s:%d: %s\n", __FILE__, __LINE__, #test);\
|
2019-06-13 16:09:05 +01:00
|
|
|
exit(1);\
|
|
|
|
}\
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define requiref(test, msg, ...) \
|
|
|
|
do { \
|
|
|
|
if(!(test)) { \
|
|
|
|
printf(msg, ##__VA_ARGS__);\
|
2019-08-05 13:02:10 +01:00
|
|
|
printf("failed:\n\t%s:%d: %s\n", __FILE__, __LINE__, #test);\
|
2019-06-13 16:09:05 +01:00
|
|
|
exit(1);\
|
|
|
|
}\
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define require_noerror(err) \
|
|
|
|
do { \
|
|
|
|
if(strcmp("", err) != 0) { \
|
2019-08-05 13:02:10 +01:00
|
|
|
printf("failed:\n\t%s:%d: %s\n", __FILE__, __LINE__, err);\
|
2019-06-13 16:09:05 +01:00
|
|
|
exit(1);\
|
|
|
|
}\
|
|
|
|
} while (0)
|
2019-12-17 12:35:17 +00:00
|
|
|
|
|
|
|
#define require_error(err) \
|
|
|
|
do { \
|
|
|
|
if(strcmp("", err) == 0) { \
|
|
|
|
printf("failed:\n\t%s:%d: %s\n", __FILE__, __LINE__, err);\
|
|
|
|
exit(1);\
|
|
|
|
}\
|
|
|
|
} while (0)
|