|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67668 - trunk/libs/units/test
From: steven_at_[hidden]
Date: 2011-01-04 19:14:21
Author: steven_watanabe
Date: 2011-01-04 19:14:20 EST (Tue, 04 Jan 2011)
New Revision: 67668
URL: http://svn.boost.org/trac/boost/changeset/67668
Log:
Regexify testing of infinity and NaN. Refs #5037.
Text files modified:
trunk/libs/units/test/test_output.cpp | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
Modified: trunk/libs/units/test/test_output.cpp
==============================================================================
--- trunk/libs/units/test/test_output.cpp (original)
+++ trunk/libs/units/test/test_output.cpp 2011-01-04 19:14:20 EST (Tue, 04 Jan 2011)
@@ -313,19 +313,11 @@
BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::max()*meter_base_unit::unit_type(), "1.79769e+308 meter");
BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::min()*meter_base_unit::unit_type(), "2.22507e-308 meter");
// Infinity and NaN
-#if defined(_MSC_VER)
- BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "1.#INF meter");
- BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "-1.#INF meter");
- BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "1.#QNAN meter");
- BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "-1.#IND meter");
-#elif defined(__GLIBCXX__)
- BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "inf meter");
- BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "-inf meter");
- BOOST_UNITS_TEST_OUTPUT(std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "nan meter");
- BOOST_UNITS_TEST_OUTPUT(-std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "-nan meter");
-#else
- // TODO infinity on other platforms?
-#endif
+ BOOST_UNITS_TEST_OUTPUT_REGEX(std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "(1\\.#INF|inf) meter");
+ BOOST_UNITS_TEST_OUTPUT_REGEX(-std::numeric_limits<float>::infinity()*meter_base_unit::unit_type(), "-(1\\.#INF|inf) meter");
+ BOOST_UNITS_TEST_OUTPUT_REGEX(std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "(1\\.#QNAN|nan) meter");
+ BOOST_UNITS_TEST_OUTPUT_REGEX(-std::numeric_limits<double>::quiet_NaN()*meter_base_unit::unit_type(), "-?(1\\.#IND|nan) meter");
+
BOOST_UNITS_TEST_OUTPUT(1.5*velocity(), "1.5 meter second^-1");
BOOST_UNITS_TEST_OUTPUT(1.5*scaled_length(), "1.5 kilometer");
BOOST_UNITS_TEST_OUTPUT(1.5*scaled_velocity1(), "1.5 kilo(meter second^-1)");
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