diff options
Diffstat (limited to 'libs/math/test/test_nc_chi_squared.cpp')
-rw-r--r-- | libs/math/test/test_nc_chi_squared.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/libs/math/test/test_nc_chi_squared.cpp b/libs/math/test/test_nc_chi_squared.cpp index 756604ba5d..f167368f85 100644 --- a/libs/math/test/test_nc_chi_squared.cpp +++ b/libs/math/test/test_nc_chi_squared.cpp @@ -31,6 +31,7 @@ #include "functor.hpp" #include "handle_test_result.hpp" #include "test_nccs_hooks.hpp" +#include "table_type.hpp" #include <iostream> using std::cout; @@ -357,38 +358,38 @@ T nccs_ccdf(T df, T nc, T x) return cdf(complement(boost::math::non_central_chi_squared_distribution<T>(df, nc), x)); } -template <typename T> +template <typename Real, typename T> void do_test_nc_chi_squared(T& data, const char* type_name, const char* test) { typedef typename T::value_type row_type; - typedef typename row_type::value_type value_type; + typedef Real value_type; std::cout << "Testing: " << test << std::endl; value_type (*fp1)(value_type, value_type, value_type) = nccs_cdf; boost::math::tools::test_result<value_type> result; - result = boost::math::tools::test( + result = boost::math::tools::test_hetero<Real>( data, - bind_func(fp1, 0, 1, 2), - extract_result(3)); + bind_func<Real>(fp1, 0, 1, 2), + extract_result<Real>(3)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "CDF", test); fp1 = nccs_ccdf; - result = boost::math::tools::test( + result = boost::math::tools::test_hetero<Real>( data, - bind_func(fp1, 0, 1, 2), - extract_result(4)); + bind_func<Real>(fp1, 0, 1, 2), + extract_result<Real>(4)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "CCDF", test); #ifdef TEST_OTHER fp1 = other::nccs_cdf; - result = boost::math::tools::test( + result = boost::math::tools::test_hetero<Real>( data, - bind_func(fp1, 0, 1, 2), - extract_result(3)); + bind_func<Real>(fp1, 0, 1, 2), + extract_result<Real>(3)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::CDF", test); #endif @@ -397,11 +398,11 @@ void do_test_nc_chi_squared(T& data, const char* type_name, const char* test) } -template <typename T> +template <typename Real, typename T> void quantile_sanity_check(T& data, const char* type_name, const char* test) { typedef typename T::value_type row_type; - typedef typename row_type::value_type value_type; + typedef Real value_type; // // Tests with type real_concept take rather too long to run, so @@ -429,7 +430,7 @@ void quantile_sanity_check(T& data, const char* type_name, const char* test) for(unsigned i = 0; i < data.size(); ++i) { - if(data[i][3] == 0) + if(Real(data[i][3]) == 0) { BOOST_CHECK(0 == quantile(boost::math::non_central_chi_squared_distribution<value_type>(data[i][0], data[i][1]), data[i][3])); } @@ -500,12 +501,12 @@ template <typename T> void test_accuracy(T, const char* type_name) { #include "nccs.ipp" - do_test_nc_chi_squared(nccs, type_name, "Non Central Chi Squared, medium parameters"); - quantile_sanity_check(nccs, type_name, "Non Central Chi Squared, medium parameters"); + do_test_nc_chi_squared<T>(nccs, type_name, "Non Central Chi Squared, medium parameters"); + quantile_sanity_check<T>(nccs, type_name, "Non Central Chi Squared, medium parameters"); #include "nccs_big.ipp" - do_test_nc_chi_squared(nccs_big, type_name, "Non Central Chi Squared, large parameters"); - quantile_sanity_check(nccs_big, type_name, "Non Central Chi Squared, large parameters"); + do_test_nc_chi_squared<T>(nccs_big, type_name, "Non Central Chi Squared, large parameters"); + quantile_sanity_check<T>(nccs_big, type_name, "Non Central Chi Squared, large parameters"); } int test_main(int, char* []) @@ -524,7 +525,7 @@ int test_main(int, char* []) #ifdef TEST_LDOUBLE test_spots(0.0L); // Test long double. #endif -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS #ifdef TEST_REAL_CONCEPT test_spots(boost::math::concepts::real_concept(0.)); // Test real concept. #endif @@ -541,7 +542,7 @@ int test_main(int, char* []) #ifdef TEST_LDOUBLE test_accuracy(0.0L, "long double"); // Test long double. #endif -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS #ifdef TEST_REAL_CONCEPT test_accuracy(boost::math::concepts::real_concept(0.), "real_concept"); // Test real concept. #endif |