aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/main.h
diff options
context:
space:
mode:
authorGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2016-05-11 19:40:45 +0200
committerGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2016-05-11 19:40:45 +0200
commit8d4ef391b0ef9a161727b9c72ef784de9b127390 (patch)
treec7cd59efd8b7a0e8d79147a44ce908a0516b7e30 /test/main.h
parentbda21407ddc3585f4feb4d1c305ae16733b34499 (diff)
Don't flood test output with successful VERIFY_IS_NOT_EQUAL tests.
Diffstat (limited to 'test/main.h')
-rw-r--r--test/main.h14
1 files changed, 7 insertions, 7 deletions
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<Derived>& m)
// Forward declaration to avoid ICC warning
template<typename T, typename U>
-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<typename T, typename U>
-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;
}