Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86301 - sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test
From: john_at_[hidden]
Date: 2013-10-14 11:41:17


Author: johnmaddock
Date: 2013-10-14 11:41:17 EDT (Mon, 14 Oct 2013)
New Revision: 86301
URL: http://svn.boost.org/trac/boost/changeset/86301

Log:
improve error reporting

Text files modified:
   sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float.cpp | 14 ++++++++++++++
   1 files changed, 14 insertions(+), 0 deletions(-)

Modified: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float.cpp
==============================================================================
--- sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float.cpp Mon Oct 14 11:25:21 2013 (r86300)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/test/test_cpp_bin_float.cpp 2013-10-14 11:41:17 EDT (Mon, 14 Oct 2013) (r86301)
@@ -149,6 +149,7 @@
 int main()
 {
    test_special_cases();
+ unsigned error_count = 0;
    for(unsigned i = 0; i < 100000; ++i)
    {
       good_type a = generate_random<good_type>();
@@ -200,6 +201,19 @@
       BOOST_CHECK_EQUAL(test_type(a / -si), ta / -si);
       BOOST_CHECK_EQUAL(test_type(a / ui), ta / ui);
       BOOST_CHECK_EQUAL(test_type(-a / ui), -ta / ui);
+
+ // Error reporting:
+ if(boost::detail::test_errors() != error_count)
+ {
+ error_count = boost::detail::test_errors();
+ std::cout << std::setprecision(std::numeric_limits<test_type>::max_digits10) << std::scientific;
+ std::cout << "a (mpfr) = " << a << std::endl;
+ std::cout << "a (test) = " << ta << std::endl;
+ std::cout << "b (mpfr) = " << b << std::endl;
+ std::cout << "b (test) = " << tb << std::endl;
+ std::cout << "si = " << si << std::endl;
+ std::cout << "ui = " << ui << std::endl;
+ }
    }
    return boost::report_errors();
 }


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