diff options
author | Thomas Capricelli <orzel@freehackers.org> | 2010-02-27 17:56:22 +0100 |
---|---|---|
committer | Thomas Capricelli <orzel@freehackers.org> | 2010-02-27 17:56:22 +0100 |
commit | e0830cb1b703d6eb4aa50c3f8332c11a32a7a764 (patch) | |
tree | 617eca74daa4c14746870dda99f022cae70204e9 /test/main.h | |
parent | 6c9eb36222dc144e73a577b836b133bc598fb145 (diff) |
Use a specialization of test_is_equal() instead of defining COMPARE()
Diffstat (limited to 'test/main.h')
-rw-r--r-- | test/main.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/test/main.h b/test/main.h index f4cfa11c5..d4f96e3d2 100644 --- a/test/main.h +++ b/test/main.h @@ -157,13 +157,6 @@ 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)) @@ -385,6 +378,17 @@ bool test_is_equal(const Derived1& a1, const Derived2& a2) return test_is_equal_impl<Derived1, Derived2>::run(a1, a2); } +bool test_is_equal(const int actual, const int expected) +{ + if (actual==expected) + return true; + // false: + std::cerr + << std::endl << " actual = " << actual + << std::endl << " expected = " << expected << std::endl << std::endl; + return false; +} + /** Creates a random Partial Isometry matrix of given rank. * * A partial isometry is a matrix all of whose singular values are either 0 or 1. |