|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81162 - in trunk/libs/conversion: . test
From: antoshkka_at_[hidden]
Date: 2012-11-03 12:20:45
Author: apolukhin
Date: 2012-11-03 12:20:43 EDT (Sat, 03 Nov 2012)
New Revision: 81162
URL: http://svn.boost.org/trac/boost/changeset/81162
Log:
Attempt to workaround VACPP, CRAY and ancient GCC bugs in lexical_cast tests
Text files modified:
trunk/libs/conversion/lexical_cast_test.cpp | 8 +++++++-
trunk/libs/conversion/test/lexical_cast_float_types_test.cpp | 4 ++++
trunk/libs/conversion/test/lexical_cast_inf_nan_test.cpp | 4 ++++
trunk/libs/conversion/test/lexical_cast_loopback_test.cpp | 4 ++++
4 files changed, 19 insertions(+), 1 deletions(-)
Modified: trunk/libs/conversion/lexical_cast_test.cpp
==============================================================================
--- trunk/libs/conversion/lexical_cast_test.cpp (original)
+++ trunk/libs/conversion/lexical_cast_test.cpp 2012-11-03 12:20:43 EDT (Sat, 03 Nov 2012)
@@ -243,9 +243,15 @@
BOOST_CHECK_EQUAL(false, lexical_cast<bool>(0));
BOOST_CHECK_THROW(lexical_cast<bool>(123), bad_lexical_cast);
BOOST_CHECK_EQUAL(true, lexical_cast<bool>(1.0));
+ BOOST_CHECK_THROW(lexical_cast<bool>(-123), bad_lexical_cast);
BOOST_CHECK_EQUAL(false, lexical_cast<bool>(0.0));
+ BOOST_CHECK_THROW(lexical_cast<bool>(1234), bad_lexical_cast);
+#if !defined(_CRAYC)
+ // Looks like a bug in CRAY compiler (throws bad_lexical_cast)
+ // TODO: localize the bug and report it to developers.
BOOST_CHECK_EQUAL(true, lexical_cast<bool>(true));
BOOST_CHECK_EQUAL(false, lexical_cast<bool>(false));
+#endif
BOOST_CHECK_EQUAL(true, lexical_cast<bool>("1"));
BOOST_CHECK_EQUAL(false, lexical_cast<bool>("0"));
BOOST_CHECK_THROW(lexical_cast<bool>(""), bad_lexical_cast);
@@ -602,7 +608,7 @@
#endif
template <class To, class From, class Func>
-To try_cast_by_ptr(const From& from, const Func& f) {
+To try_cast_by_ptr(const From& from, Func f) {
return f(from);
};
Modified: trunk/libs/conversion/test/lexical_cast_float_types_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_float_types_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_float_types_test.cpp 2012-11-03 12:20:43 EDT (Sat, 03 Nov 2012)
@@ -505,7 +505,11 @@
}
void test_conversion_from_to_long_double()
{
+// We do not run tests on compilers with bugs
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_conversion_from_to_float<long double>();
+#endif
+ BOOST_CHECK(true);
}
Modified: trunk/libs/conversion/test/lexical_cast_inf_nan_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_inf_nan_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_inf_nan_test.cpp 2012-11-03 12:20:43 EDT (Sat, 03 Nov 2012)
@@ -186,7 +186,11 @@
void test_inf_nan_long_double()
{
+// We do not run tests on compilers with bugs
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_inf_nan_templated<long double >();
+#endif
+ BOOST_CHECK(true);
}
unit_test::test_suite *init_unit_test_suite(int, char *[])
Modified: trunk/libs/conversion/test/lexical_cast_loopback_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_loopback_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_loopback_test.cpp 2012-11-03 12:20:43 EDT (Sat, 03 Nov 2012)
@@ -86,7 +86,11 @@
void test_round_conversion_long_double()
{
+// We do not run tests on compilers with bugs
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
test_round_conversion<long double>();
test_msvc_magic_values<long double>();
+#endif
+ BOOST_CHECK(true);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk