From dd93c7c9a4562a5bc6b89687dcf521e569eede1b Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 21 Apr 2005 23:41:12 +0000 Subject: [PATCH] Change hash_float_test to write out some false failures instead of failing. [SVN r28393] --- test/Jamfile | 11 ++++++++- test/Jamfile.v2 | 2 +- test/hash_float_test.cpp | 50 ++++++++++++++++++++++++++++------------ 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/test/Jamfile b/test/Jamfile index aada1dd..93f1678 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -19,13 +19,22 @@ rule hash-test ( name ) ] ; } +rule hash-test-output ( name ) +{ + return [ + run $(name).cpp + ../../../test/build/boost_unit_test_framework + : : : $(BOOST_ROOT) always_show_run_output + ] ; +} + { test-suite functional/hash : [ hash-test hash_number_test ] [ hash-test hash_pointer_test ] [ hash-test hash_function_pointer_test ] - [ hash-test hash_float_test ] + [ hash-test-output hash_float_test ] [ hash-test hash_string_test ] [ hash-test hash_range_test ] [ hash-test hash_custom_test ] diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 1f1446b..0433fb2 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -13,7 +13,7 @@ test-suite functional/hash [ run hash_number_test.cpp framework ] [ run hash_pointer_test.cpp framework ] [ run hash_function_pointer_test.cpp framework ] - [ run hash_float_test.cpp framework ] + [ run hash_float_test.cpp framework : : : always_show_run_output ] [ run hash_string_test.cpp framework ] [ run hash_range_test.cpp framework ] [ run hash_custom_test.cpp framework ] diff --git a/test/hash_float_test.cpp b/test/hash_float_test.cpp index 7765063..5626ea7 100644 --- a/test/hash_float_test.cpp +++ b/test/hash_float_test.cpp @@ -20,8 +20,12 @@ #include template -void float_tests(T* = 0) +void float_tests(T* = 0, char const* name) { + std::cout<<"\n" + "Testing " BOOST_STRINGIZE(HASH_NAMESPACE) "::hash<"<\n" + "\n"; + HASH_NAMESPACE::hash x1; T zero = 0; @@ -36,7 +40,9 @@ void float_tests(T* = 0) using namespace std; // Doing anything with infinity causes borland to crash. -#if !defined(__BORLANDC__) +#if defined(__BORLANDC__) + std::cout<<"Not running infinity checks on Borland, as it causes it to crash.\n"; +#else if(std::numeric_limits::has_infinity) { T infinity = -log(zero); T infinity2 = (T) 1. / zero; @@ -66,19 +72,28 @@ void float_tests(T* = 0) BOOST_CHECK(infinity != minus_infinity); // My hash fails this one, I guess it's not that bad. - BOOST_WARN(x1(infinity) != x1(minus_infinity)); + if(x1(infinity) == x1(minus_infinity)) { + std::cout<<"x1(infinity) == x1(-infinity) == "<::has_denorm) { - BOOST_CHECK(x1(std::numeric_limits::denorm_min()) != x1(infinity)); - BOOST_CHECK(x1(std::numeric_limits::denorm_min()) != x1(minus_infinity)); + if(x1(std::numeric_limits::denorm_min()) == x1(infinity)) { + std::cout<<"x1(denorm_min) == x1(infinity) == "<::denorm_min()) == x1(minus_infinity)) { + std::cout<<"x1(denorm_min) == x1(-infinity) == "<::has_quiet_NaN) { - // Another two failures, should I work around this? - BOOST_WARN(x1(std::numeric_limits::quiet_NaN()) != x1(infinity)); - BOOST_WARN(x1(std::numeric_limits::quiet_NaN()) != x1(minus_infinity)); + if(x1(std::numeric_limits::quiet_NaN()) == x1(infinity)) { + std::cout<<"x1(quiet_NaN) == x1(infinity) == "<::quiet_NaN()) == x1(minus_infinity)) { + std::cout<<"x1(quiet_NaN) == x1(-infinity) == "<