Skip to content

Instantly share code, notes, and snippets.

@LukasWoodtli
Last active June 15, 2023 09:14
Show Gist options
  • Save LukasWoodtli/5336b1c56f5bdf9361d812c0feba8bcd to your computer and use it in GitHub Desktop.
Save LukasWoodtli/5336b1c56f5bdf9361d812c0feba8bcd to your computer and use it in GitHub Desktop.
#include <sstream>
// poor man's unit testing framework
#define ASSERT_EQUALS(a, b) do { \
std::cerr << std::boolalpha; \
std::stringstream as, bs; \
as << a; bs << b; \
if (as.str() != bs.str()) { \
std::cerr << as.str() << "\nis not equal to\n" << bs.str() << "\nin line " << __LINE__ << std::endl; \
exit(1); } } while(0)
#define DEBUG(d) do { \
std::cerr << #d ": " << d << endl; } while(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment