From 8d4ef391b0ef9a161727b9c72ef784de9b127390 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Wed, 11 May 2016 19:40:45 +0200 Subject: Don't flood test output with successful VERIFY_IS_NOT_EQUAL tests. --- test/main.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/main.h') diff --git a/test/main.h b/test/main.h index 1bfb9e1b0..c66c2b62e 100644 --- a/test/main.h +++ b/test/main.h @@ -279,8 +279,8 @@ inline void verify_impl(bool condition, const char *testname, const char *file, #define VERIFY_LE(a, b) ::verify_impl(a <= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EI_PP_MAKE_STRING(a <= b)) -#define VERIFY_IS_EQUAL(a, b) VERIFY(test_is_equal(a, b)) -#define VERIFY_IS_NOT_EQUAL(a, b) VERIFY(!test_is_equal(a, b)) +#define VERIFY_IS_EQUAL(a, b) VERIFY(test_is_equal(a, b, true)) +#define VERIFY_IS_NOT_EQUAL(a, b) VERIFY(test_is_equal(a, b, false)) #define VERIFY_IS_APPROX(a, b) VERIFY(verifyIsApprox(a, b)) #define VERIFY_IS_NOT_APPROX(a, b) VERIFY(!test_isApprox(a, b)) #define VERIFY_IS_MUCH_SMALLER_THAN(a, b) VERIFY(test_isMuchSmallerThan(a, b)) @@ -517,17 +517,17 @@ inline bool test_isUnitary(const MatrixBase& m) // Forward declaration to avoid ICC warning template -bool test_is_equal(const T& actual, const U& expected); +bool test_is_equal(const T& actual, const U& expected, bool expect_equal=true); template -bool test_is_equal(const T& actual, const U& expected) +bool test_is_equal(const T& actual, const U& expected, bool expect_equal) { - if (actual==expected) + if ((actual==expected) == expect_equal) return true; // false: std::cerr - << std::endl << " actual = " << actual - << std::endl << " expected = " << expected << std::endl << std::endl; + << "\n actual = " << actual + << "\n expected " << (expect_equal ? "= " : "!=") << expected << "\n\n"; return false; } -- cgit v1.2.3