mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 16:32:10 +00:00
Improve test coverage.
Try and get all the special_functions/a*.hpp files up to 100%.
This commit is contained in:
@@ -186,7 +186,7 @@ T airy_ai_zero_imp(int m, const Policy& pol)
|
||||
std::uintmax_t iterations_used = iterations_allowed;
|
||||
|
||||
// Use a dynamic tolerance because the roots get closer the higher m gets.
|
||||
T tolerance;
|
||||
T tolerance; // LCOV_EXCL_LINE
|
||||
|
||||
if (m <= 10) { tolerance = T(0.3F); }
|
||||
else if(m <= 100) { tolerance = T(0.1F); }
|
||||
@@ -238,7 +238,7 @@ T airy_bi_zero_imp(int m, const Policy& pol)
|
||||
std::uintmax_t iterations_used = iterations_allowed;
|
||||
|
||||
// Use a dynamic tolerance because the roots get closer the higher m gets.
|
||||
T tolerance;
|
||||
T tolerance; // LCOV_EXCL_LINE
|
||||
|
||||
if (m <= 10) { tolerance = T(0.3F); }
|
||||
else if(m <= 100) { tolerance = T(0.1F); }
|
||||
|
||||
@@ -40,21 +40,15 @@ namespace boost
|
||||
|
||||
if(x < -1)
|
||||
{
|
||||
return policies::raise_domain_error<T>(
|
||||
function,
|
||||
"atanh requires x >= -1, but got x = %1%.", x, pol);
|
||||
return policies::raise_domain_error<T>(function, "atanh requires x >= -1, but got x = %1%.", x, pol);
|
||||
}
|
||||
else if(x > 1)
|
||||
{
|
||||
return policies::raise_domain_error<T>(
|
||||
function,
|
||||
"atanh requires x <= 1, but got x = %1%.", x, pol);
|
||||
return policies::raise_domain_error<T>(function, "atanh requires x <= 1, but got x = %1%.", x, pol);
|
||||
}
|
||||
else if((boost::math::isnan)(x))
|
||||
{
|
||||
return policies::raise_domain_error<T>(
|
||||
function,
|
||||
"atanh requires -1 <= x <= 1, but got x = %1%.", x, pol);
|
||||
return policies::raise_domain_error<T>(function, "atanh requires -1 <= x <= 1, but got x = %1%.", x, pol);
|
||||
}
|
||||
else if(x < -1 + tools::epsilon<T>())
|
||||
{
|
||||
|
||||
@@ -83,7 +83,14 @@ BOOST_TEST_CASE_TEMPLATE_FUNCTION(acosh_test, T)
|
||||
{
|
||||
T inf = std::numeric_limits<T>::infinity();
|
||||
boost::math::policies::policy<boost::math::policies::overflow_error<boost::math::policies::ignore_error> > pol;
|
||||
BOOST_CHECK_EQUAL(boost::math::asinh(inf, pol), inf);
|
||||
BOOST_CHECK_EQUAL(boost::math::acosh(inf, pol), inf);
|
||||
}
|
||||
x = -1;
|
||||
BOOST_CHECK_THROW(boost::math::acosh(x), std::domain_error);
|
||||
if (std::numeric_limits<T>::has_quiet_NaN)
|
||||
{
|
||||
T n = std::numeric_limits<T>::quiet_NaN();
|
||||
BOOST_CHECK_THROW(boost::math::acosh(n), std::domain_error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,11 @@ BOOST_TEST_CASE_TEMPLATE_FUNCTION(asinh_test, T)
|
||||
BOOST_CHECK_EQUAL(boost::math::asinh(inf, pol), inf);
|
||||
BOOST_CHECK_EQUAL(boost::math::asinh(-inf, pol), -inf);
|
||||
}
|
||||
if(std::numeric_limits<T>::has_quiet_NaN)
|
||||
{
|
||||
T n = std::numeric_limits<T>::quiet_NaN();
|
||||
BOOST_CHECK_THROW(boost::math::asinh(n), std::domain_error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -89,6 +89,11 @@ BOOST_TEST_CASE_TEMPLATE_FUNCTION(atanh_test, T)
|
||||
BOOST_MATH_CHECK_THROW(atanh(T(1)), std::overflow_error);
|
||||
BOOST_MATH_CHECK_THROW(atanh(T(-2)), std::domain_error);
|
||||
BOOST_MATH_CHECK_THROW(atanh(T(2)), std::domain_error);
|
||||
if (std::numeric_limits<T>::has_quiet_NaN)
|
||||
{
|
||||
T n = std::numeric_limits<T>::quiet_NaN();
|
||||
BOOST_CHECK_THROW(boost::math::atanh(n), std::domain_error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user