diff --git a/test/test_gamma_edge.cpp b/test/test_gamma_edge.cpp index 1bab92b1e..bb29b6b47 100644 --- a/test/test_gamma_edge.cpp +++ b/test/test_gamma_edge.cpp @@ -6,8 +6,13 @@ #include #include +#include + namespace local { + std::mt19937 eng(static_cast(UINT8_C(42))); + std::uniform_int_distribution dst_one(1, 1); + template auto is_close_fraction(const NumericType& a, const NumericType& b, @@ -82,7 +87,7 @@ namespace local if(!result_tgamma_x_small_is_ok) { - break; + break; // LCOV_EXCL_LINE } } } @@ -99,8 +104,32 @@ namespace local using local_float_type = boost::multiprecision::number, boost::multiprecision::et_off>; { + const local_float_type my_tol { std::numeric_limits::epsilon() * 256 }; + + for(auto index = static_cast(UINT8_C(0)); index < static_cast(UINT8_C(3)); ++index) + { + static_cast(index); + + const local_float_type zero_ctrl { 0 }; + + local_float_type zero { 0 }; + + zero *= dst_one(eng); + + const auto result_zero_is_ok = is_close_fraction(zero, zero_ctrl, my_tol); + + BOOST_TEST(result_zero_is_ok); + } + } + + for(auto index = static_cast(UINT8_C(0)); index < static_cast(UINT8_C(3)); ++index) + { + static_cast(index); + local_float_type zero { 0 }; + zero *= dst_one(eng); + bool domain_error_is_ok { false }; try @@ -117,9 +146,14 @@ namespace local BOOST_TEST(domain_error_is_ok); } + for(auto index = static_cast(UINT8_C(0)); index < static_cast(UINT8_C(3)); ++index) { + static_cast(index); + local_float_type my_nan = std::numeric_limits::quiet_NaN(); + my_nan *= dst_one(eng); + bool domain_error_is_ok { false }; try @@ -136,9 +170,14 @@ namespace local BOOST_TEST(domain_error_is_ok); } + for(auto index = static_cast(UINT8_C(0)); index < static_cast(UINT8_C(3)); ++index) { + static_cast(index); + local_float_type my_inf = -std::numeric_limits::infinity(); + my_inf *= dst_one(eng); + bool domain_error_is_ok { false }; try @@ -202,9 +241,14 @@ namespace local using local_float_type = boost::multiprecision::number, boost::multiprecision::et_off>; + for(auto index = static_cast(UINT8_C(0)); index < static_cast(UINT8_C(3)); ++index) { + static_cast(index); + local_float_type zero { 0 }; + zero *= dst_one(eng); + bool domain_error_is_ok { false }; try @@ -221,9 +265,14 @@ namespace local BOOST_TEST(domain_error_is_ok); } + for(auto index = static_cast(UINT8_C(0)); index < static_cast(UINT8_C(3)); ++index) { + static_cast(index); + local_float_type my_nan = std::numeric_limits::quiet_NaN(); + my_nan *= dst_one(eng); + bool domain_error_is_ok { false }; try @@ -240,9 +289,14 @@ namespace local BOOST_TEST(domain_error_is_ok); } + for(auto index = static_cast(UINT8_C(0)); index < static_cast(UINT8_C(3)); ++index) { + static_cast(index); + local_float_type my_inf = -std::numeric_limits::infinity(); + my_inf *= dst_one(eng); + bool overflow_error_is_ok { false }; try