diff options
author | Thomas Capricelli <orzel@freehackers.org> | 2010-02-27 16:30:15 +0100 |
---|---|---|
committer | Thomas Capricelli <orzel@freehackers.org> | 2010-02-27 16:30:15 +0100 |
commit | 15a33622acfb195935adf190508d7e9e8238c4ee (patch) | |
tree | 334f4a077d3c5c7a41797bcfa9f0597d62e51e60 /test/main.h | |
parent | d9f638049994b90ed388c68c8a0ab7efc2e5615c (diff) |
* define COMPARE(,), which prints expected/actual results in case of failure
* use it in test/NonLinearOptimization.cpp
Diffstat (limited to 'test/main.h')
-rw-r--r-- | test/main.h | 7 |
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)) |