Skip to content

Commit

Permalink
Merge pull request #132 from ecmwf/fix/test-macros
Browse files Browse the repository at this point in the history
looks good to me
  • Loading branch information
danovaro authored Jul 5, 2024
2 parents fd30bdf + d6bb784 commit 27e0f2a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/eckit/testing/Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,20 +453,20 @@ int run_tests(int argc, char* argv[], bool initEckitMain = true) {
#define EXPECT_MSG(expr, msg_callback) \
do { \
if (!(expr)) { \
auto msg = msg_callback; \
msg(); \
auto _msg = msg_callback; \
_msg(); \
throw eckit::testing::TestException("Condition failed: " #expr, Here()); \
} \
} while (false)

#define EXPECT_EQUAL(a, b) \
EXPECT_MSG(a == b, [=]() { \
EXPECT_MSG(a == b, [&]() { \
std::cerr << eckit::Colour::red << "FAILED " << #a " == " << #b << " evaluated as [" << a << "] == [" << b \
<< "]" << eckit::Colour::reset << std::endl; \
};)

#define EXPECT_NOT_EQUAL(a, b) \
EXPECT_MSG(a != b, [=]() { \
EXPECT_MSG(a != b, [&]() { \
std::cerr << eckit::Colour::red << "FAILED " << #a " != " << #b << " evaluated as [" << a << "] != [" << b \
<< "]" << eckit::Colour::reset << std::endl; \
};)
Expand Down

0 comments on commit 27e0f2a

Please sign in to comment.