#include <stdio.h>
#define __ASSERT_INT(COND, format, ...) \
do { \
if (!COND) { \
printf(""#COND); \
printf(" "); \
printf(format "%s", __VA_ARGS__); \
} \
} while (0)
#define ASSERT(COND, ...) __ASSERT_INT(COND, __VA_ARGS__, "\n")
int
main() {
ASSERT(0==1);
ASSERT(0==1, "here");
ASSERT(0==1, "and here %d", 2);
return 0;
}
No comments:
Post a Comment