Commit 315f4c12 by Sergey.Kolodchenko

Upload New File

parent 3c89da9e
Showing with 28 additions and 0 deletions
#include <stdio.h>
#define DEBUG(X) do { \
printf("%s %s:%d - %s = %d (%p)\n", \
__FILE__, __FUNCTION__, __LINE__, #X, X, &X); \
} while(0)
#define MY_ASSERT(EXPR, MSG) do { \
if (!EXPR) { \
printf("[FAIL] at %s - %s in %s %s: %d | '%s' - %s\n", \
__DATE__, __TIME__, __FILE__, __FUNCTION__, \
__LINE__, #EXPR, (MSG));
#idef EXIT_ON_FAIL
exit(-1); \
} \
} while(0)
int main(int argc, char **argv) {
MY_ASSERT((argc > 1), "This program should have more than 1 arg\n");
printf("args: %d\n\n", argc);
int x = 5;
puts("My cool prog.\n");
for (int i = 0; i < 7; i++) {
DEBUG(i);
MY_ASSERT((i < x), "i should be less than 5");
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment