Skip to content

Commit efdae58

Browse files
committed
Further cleanup of test case
1 parent ab6bfb0 commit efdae58

1 file changed

Lines changed: 17 additions & 25 deletions

File tree

test/test_cpp_double_float_bessel_versus_bin_and_dec.cpp

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2024 - 2025.
2+
// Copyright Christopher Kormanyos 2024 - 2026.
33
// Distributed under the Boost
44
// Software License, Version 1.0. (See accompanying file
55
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
@@ -190,8 +190,6 @@ auto do_trials(const std::size_t trial_count) -> void
190190
static std::size_t heat_count { };
191191
static std::size_t total_count { };
192192

193-
std::cout << "\nheat_count: " << ++heat_count << std::endl;
194-
195193
using dbl_float_type = boost::multiprecision::cpp_double_double;
196194

197195
constexpr int local_digits10 = ((std::numeric_limits<dbl_float_type>::digits10 < 32) ? 32 : std::numeric_limits<dbl_float_type>::digits10);
@@ -319,28 +317,9 @@ auto do_trials(const std::size_t trial_count) -> void
319317
const double elapsed_flt { stopwatch_type::elapsed_time<double>(my_stopwatch) };
320318
#endif
321319

322-
std::stringstream strm { };
323-
324-
strm << std::fixed << std::setprecision(3) << "elapsed_dbl : " << elapsed_dbl << "s\n"
325-
<< std::fixed << std::setprecision(3) << "elapsed_dec : " << elapsed_dec << "s\n"
326-
<< std::fixed << std::setprecision(3) << "elapsed_bin : " << elapsed_bin << "s\n"
327-
#if defined(BOOST_HAS_FLOAT128)
328-
<< std::fixed << std::setprecision(3) << "elapsed_flt : " << elapsed_flt << "s\n"
329-
#endif
330-
<< std::fixed << std::setprecision(3) << "ratio (dec/dbl) : " << elapsed_dec / elapsed_dbl << "\n"
331-
<< std::fixed << std::setprecision(3) << "ratio (bin/dbl) : " << elapsed_bin / elapsed_dbl << "\n"
332-
#if defined(BOOST_HAS_FLOAT128)
333-
<< std::fixed << std::setprecision(3) << "ratio (flt/dbl) : " << elapsed_flt / elapsed_dbl << "\n"
334-
#endif
335-
;
336-
337320
BOOST_TEST(elapsed_dec / elapsed_dbl > 1.0);
338321
BOOST_TEST(elapsed_bin / elapsed_dbl > 1.0);
339322

340-
std::cout << strm.str() << std::endl;
341-
342-
std::cout << "verifying results...\n";
343-
344323
std::size_t count { UINT8_C(0) };
345324

346325
constexpr dbl_float_type tol_dbl { std::numeric_limits<dbl_float_type>::epsilon() * 0x1000000 };
@@ -353,16 +332,29 @@ auto do_trials(const std::size_t trial_count) -> void
353332
const dbl_float_type ctrl_flt { flt_float_c_vec[count] };
354333
#endif
355334

356-
BOOST_TEST(is_close_fraction(lhs, ctrl_dec, tol_dbl));
357-
BOOST_TEST(is_close_fraction(lhs, ctrl_bin, tol_dbl));
335+
const bool result_dec_is_ok { is_close_fraction(lhs, ctrl_dec, tol_dbl) };
336+
const bool result_bin_is_ok { is_close_fraction(lhs, ctrl_bin, tol_dbl) };
358337
#if defined(BOOST_HAS_FLOAT128)
359-
BOOST_TEST(is_close_fraction(lhs, ctrl_flt, tol_dbl));
338+
const bool result_flt_is_ok { is_close_fraction(lhs, ctrl_flt, tol_dbl) };
339+
#endif
340+
341+
BOOST_TEST(result_dec_is_ok);
342+
if(!result_dec_is_ok) { std::stringstream strm { }; strm << std::setprecision(local_digits10) << "expected: " << ctrl_dec << ", got: " << lhs << ", a: " << dec_float_a_vec.at(count) << ", b: " << dec_float_b_vec.at(count); std::cout << strm.str() << std::endl; }
343+
344+
BOOST_TEST(result_bin_is_ok);
345+
if(!result_bin_is_ok) { std::stringstream strm { }; strm << std::setprecision(local_digits10) << "expected: " << ctrl_bin << ", got: " << lhs << ", a: " << bin_float_a_vec.at(count) << ", b: " << bin_float_b_vec.at(count); std::cout << strm.str() << std::endl; }
346+
347+
#if defined(BOOST_HAS_FLOAT128)
348+
BOOST_TEST(result_flt_is_ok);
349+
if(!result_flt_is_ok) { std::stringstream strm { }; strm << std::setprecision(local_digits10) << "expected: " << ctrl_flt << ", got: " << lhs << ", a: " << flt_float_a_vec.at(count) << ", b: " << flt_float_b_vec.at(count); std::cout << strm.str() << std::endl; }
360350
#endif
361351

362352
++count;
363353
}
364354
}
365355

356+
auto main() -> int;
357+
366358
auto main() -> int
367359
{
368360
constexpr std::size_t trials { UINT32_C(0x800) };

0 commit comments

Comments
 (0)