Add more testing

This commit is contained in:
Matt Borland 2023-04-25 13:35:29 +02:00
parent 4c753c20f7
commit 2f0b0ed366
No known key found for this signature in database
GPG Key ID: 4C0F1E5EE82C7032
3 changed files with 57 additions and 3 deletions

View File

@ -9,6 +9,10 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if __has_include(<stdfloat>)
# include <stdfloat>
#endif
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) && !defined(BOOST_NO_SFINAE_EXPR)
#include <boost/math/concepts/real_concept.hpp>
@ -258,6 +262,17 @@ BOOST_AUTO_TEST_CASE(gauss_quadrature_test)
test_integration_over_real_line<double, 17>();
test_right_limit_infinite<double, 17>();
test_left_limit_infinite<double, 17>();
#ifdef __STDCPP_FLOAT64_T__
test_linear<std::float64_t, 15>();
test_quadratic<std::float64_t, 15>();
test_ca<std::float64_t, 15>();
test_three_quadrature_schemes_examples<std::float64_t, 15>();
test_integration_over_real_line<std::float64_t, 15>();
test_right_limit_infinite<std::float64_t, 15>();
test_left_limit_infinite<std::float64_t, 15>();
#endif
#endif
#ifdef TEST1A
#if LDBL_MANT_DIG < 100 // If we have too many digits in a long double, we get build errors due to a constexpr issue.

View File

@ -26,6 +26,10 @@
#include <boost/math/special_functions/ellint_rj.hpp>
#include <boost/type_index.hpp>
#if __has_include(<stdfloat>)
# include <stdfloat>
#endif
#ifdef BOOST_HAS_FLOAT128
#include <boost/multiprecision/float128.hpp>
#endif
@ -318,8 +322,14 @@ void test_ca()
// Slightly higher tolerance for type float, this marginal change was
// caused by no more than changing the order in which the terms are summed:
//
if (std::is_same<Real, float>::value)
tol *= 1.5;
BOOST_IF_CONSTEXPR (std::is_same<Real, float>::value
#ifdef __STDCPP_FLOAT32_T__
|| std::is_same<Real, std::float32_t>::value
#endif
)
{
tol *= static_cast<Real>(1.5);
}
BOOST_CHECK_CLOSE_FRACTION(Q, Q_expected, tol);
BOOST_CHECK_CLOSE_FRACTION(L1, Q_expected, tol);
@ -896,6 +906,20 @@ BOOST_AUTO_TEST_CASE(tanh_sinh_quadrature_test)
test_horrible<float>();
test_integration_over_real_line<float>();
test_nr_examples<float>();
#ifdef __STDCPP_FLOAT32_T__
test_right_limit_infinite<std::float32_t>();
test_left_limit_infinite<std::float32_t>();
test_linear<std::float32_t>();
test_quadratic<std::float32_t>();
test_singular<std::float32_t>();
test_ca<std::float32_t>();
test_three_quadrature_schemes_examples<std::float32_t>();
test_horrible<std::float32_t>();
test_integration_over_real_line<std::float32_t>();
test_nr_examples<std::float32_t>();
#endif
#endif
#ifdef TEST1A
test_early_termination<float>();

View File

@ -26,6 +26,10 @@
using std::setprecision;
using std::log;
#if __has_include(<stdfloat>)
# include <stdfloat>
#endif
template <class RealType>
void test_spot(RealType l, RealType x, RealType p, RealType q, RealType logp, RealType logq, RealType tolerance, RealType logtolerance)
{
@ -208,7 +212,11 @@ void test_spots(RealType T)
static_cast<RealType>(-9.210390371559516069440021374287500922116L), // log(p),
static_cast<RealType>(-0.000100000000000000000000000000000000000L), // log(q)
tolerance,
std::is_same<RealType, float>::value ? tolerance * 10 : tolerance);
std::is_same<RealType, float>::value
#ifdef __STDCPP_FLOAT32_T__
|| std::is_same<RealType, std::float32_t>::value
#endif
? tolerance * 10 : tolerance);
/*
// This test data appears to be erroneous, MathCad appears
// to suffer from cancellation error as x -> 0
@ -375,6 +383,13 @@ BOOST_AUTO_TEST_CASE( test_main )
"to pass.</note>" << std::endl;
#endif
#ifdef __STDCPP_FLOAT32_T__
test_spots(0.0F32);
#endif
#ifdef __STDCPP_FLOAT64_T__
test_spots(0.0F64);
#endif
} // BOOST_AUTO_TEST_CASE( test_main )
/*