Skip to content

Instantly share code, notes, and snippets.

@rubenwardy rubenwardy/macro.cpp Secret
Last active Aug 29, 2015

Embed
What would you like to do?
#define unit_test(title, func, expo, cond) \
{ auto eval = (cond); \
std::cerr << (eval?"\033[;32m":"\033[;31m"); \
fprintf(stderr, "%-23s | %-30s | %-6s :: ", (title), (func), (expo)); \
std::cerr << (eval?"PASSED":"FAILED"); \
std::cerr << COLOR_CLEAR << std::endl; \
if (!eval) failed = true; }
bool failed = false; // Turned to true in macro if test fails
// getAt : return null
unit_test("getAt 1", "getAt(0,0)", "NULL",
state->world->getAt(0, 0) == NULL);
// getAt 1 | getAt(0,0) | NULL :: PASSED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.