Skip to content

Instantly share code, notes, and snippets.

@rubenwardy
Last active August 29, 2015 14:22
Show Gist options
  • Save rubenwardy/56a8bacc26c09207172a to your computer and use it in GitHub Desktop.
Save rubenwardy/56a8bacc26c09207172a to your computer and use it in GitHub Desktop.
#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