Skip to content

Instantly share code, notes, and snippets.

@dacap
Created September 22, 2015 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacap/161de21d34c3dadae645 to your computer and use it in GitHub Desktop.
Save dacap/161de21d34c3dadae645 to your computer and use it in GitHub Desktop.
#pragma once
#include <cstdlib>
#include <iostream>
template<typename T, typename U>
inline void expect_eq(const T& expected, const U& value,
const char* file, const int line) {
if (expected != value) {
std::cout << file << ":" << line << ": failed\n"
<< " Expected: " << expected << "\n"
<< " Actual: " << value << "\n";
std::exit(1);
}
}
#define EXPECT_EQ(expected, value) \
expect_eq(expected, value, __FILE__, __LINE__);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment