Skip to content

Instantly share code, notes, and snippets.

@chenha0
Created September 14, 2012 05:52
Show Gist options
  • Save chenha0/3720052 to your computer and use it in GitHub Desktop.
Save chenha0/3720052 to your computer and use it in GitHub Desktop.
a simple C assert_equal macro
#define ASSERT_NUM_EQ(lhs, rhs) \
if ((lhs) != (rhs)) { \
printf("Assert equal %s == %s failed\n", #lhs, #rhs); \
printf("%s : %d, %s : %d\n", #lhs, lhs, #rhs, rhs); \
kill(getpid(), SIGABRT); \
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment