aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/main.h')
-rw-r--r--test/main.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/main.h b/test/main.h
index 5ca9395c2..f4cfa11c5 100644
--- a/test/main.h
+++ b/test/main.h
@@ -157,6 +157,13 @@ namespace Eigen
exit(2); \
} } while (0)
+// Use COMPARE for exact comparison of scalar values (mostly, int)
+#define COMPARE(actual, expected) do { if (actual!=expected) { \
+ std::cerr << "Test " << g_test_stack.back() << ". Comparison failed in "EI_PP_MAKE_STRING(__FILE__) << " (" << EI_PP_MAKE_STRING(__LINE__) << ")" \
+ << std::endl << " actual = " << actual \
+ << std::endl << " expected = " << expected << std::endl << std::endl; \
+ exit(2); \
+ } } while (0)
#define VERIFY_IS_EQUAL(a, b) VERIFY(test_is_equal(a, b))
#define VERIFY_IS_APPROX(a, b) VERIFY(test_ei_isApprox(a, b))
#define VERIFY_IS_NOT_APPROX(a, b) VERIFY(!test_ei_isApprox(a, b))