Skip to content

Commit

Permalink
Reduce program output.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzmaddock committed Jul 3, 2014
1 parent 4088617 commit 2b86d27
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/test_cpp_bin_float_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,21 @@ void do_round_trip(const T& val, std::ios_base::fmtflags f)
template <class T>
void do_round_trip(const T& val)
{
std::cout << "Testing value....";
if(val.backend().sign())
std::cout << "-";
std::cout << boost::multiprecision::cpp_int(val.backend().bits()) << "e" << val.backend().exponent() << std::endl;
do_round_trip(val, std::ios_base::fmtflags(0));
do_round_trip(val, std::ios_base::fmtflags(std::ios_base::scientific));
if((fabs(val) > 1) && (fabs(val) < 1e100))
do_round_trip(val, std::ios_base::fmtflags(std::ios_base::fixed));

static int error_count = 0;

if(error_count != boost::detail::test_errors())
{
error_count = boost::detail::test_errors();
std::cout << "Errors occured while testing value....";
if(val.backend().sign())
std::cout << "-";
std::cout << boost::multiprecision::cpp_int(val.backend().bits()) << "e" << val.backend().exponent() << std::endl;
}
}

template <class T>
Expand All @@ -236,6 +243,8 @@ void test_round_trip()
do_round_trip(T(-val));
do_round_trip(T(1/val));
do_round_trip(T(-1/val));

if(boost::detail::test_errors() > 200) break; // escape if there are too many errors.
}

std::cout << "Execution time = " << boost::chrono::duration_cast<boost::chrono::duration<double> >(w.elapsed()).count() << "s" << std::endl;
Expand Down

0 comments on commit 2b86d27

Please sign in to comment.