]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_nc_chi_squared.cpp
1 // test_nc_chi_squared.cpp
3 // Copyright John Maddock 2008.
5 // Use, modification and distribution are subject to the
6 // Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE_1_0.txt
8 // or copy at http://www.boost.org/LICENSE_1_0.txt)
13 #pragma warning (disable:4127 4512)
16 #if !defined(TEST_FLOAT) && !defined(TEST_DOUBLE) && !defined(TEST_LDOUBLE) && !defined(TEST_REAL_CONCEPT)
20 # define TEST_REAL_CONCEPT
23 #include <boost/math/tools/test.hpp>
24 #include <boost/math/concepts/real_concept.hpp> // for real_concept
25 #include <boost/math/distributions/non_central_chi_squared.hpp> // for chi_squared_distribution
26 #include <boost/math/special_functions/cbrt.hpp> // for chi_squared_distribution
27 #define BOOST_TEST_MAIN
28 #include <boost/test/unit_test.hpp> // for test_main
29 #include <boost/test/results_collector.hpp>
30 #include <boost/test/unit_test.hpp>
31 #include <boost/test/tools/floating_point_comparison.hpp> // for BOOST_CHECK_CLOSE
32 #include "test_out_of_range.hpp"
34 #include "functor.hpp"
35 #include "handle_test_result.hpp"
36 #include "test_nccs_hooks.hpp"
37 #include "table_type.hpp"
38 #include "test_nc_chi_squared.hpp"
45 using std::numeric_limits
;
47 void expected_results()
50 // Define the max and mean errors expected for
51 // various compilers and platforms.
53 const char* largest_type
;
54 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
55 if(boost::math::policies::digits
<double, boost::math::policies::policy
<> >() == boost::math::policies::digits
<long double, boost::math::policies::policy
<> >())
57 largest_type
= "(long\\s+)?double|real_concept";
61 largest_type
= "long double|real_concept";
64 largest_type
= "(long\\s+)?double|real_concept";
71 largest_type
, // test type(s)
72 "[^|]*medium[^|]*", // test data group
73 "[^|]*", 550, 100); // test function
75 // Catch all cases come last:
81 largest_type
, // test type(s)
82 "[^|]*medium[^|]*", // test data group
83 "[^|]*", 350, 100); // test function
88 largest_type
, // test type(s)
89 "[^|]*large[^|]*", // test data group
90 "[^|]*", 17000, 3000); // test function
93 // Allow some long double error to creep into
94 // the double results:
100 "double", // test type(s)
101 "[^|]*", // test data group
102 "[^|]*", 3, 2); // test function
105 // Finish off by printing out the compiler/stdlib/platform names,
106 // we do this to make it easier to mark up expected error rates.
108 std::cout
<< "Tests run with " << BOOST_COMPILER
<< ", "
109 << BOOST_STDLIB
<< ", " << BOOST_PLATFORM
<< std::endl
;
112 BOOST_AUTO_TEST_CASE( test_main
)
114 BOOST_MATH_CONTROL_FP
;
115 // Basic sanity-check spot values.
117 // (Parameter value, arbitrarily zero, only communicates the floating point type).
119 test_spots(0.0F
); // Test float.
122 test_spots(0.0); // Test double.
124 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
126 test_spots(0.0L); // Test long double.
128 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
129 #ifdef TEST_REAL_CONCEPT
130 test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
136 test_accuracy(0.0F
, "float"); // Test float.
139 test_accuracy(0.0, "double"); // Test double.
141 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
143 test_accuracy(0.0L, "long double"); // Test long double.
145 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
146 #ifdef TEST_REAL_CONCEPT
147 test_accuracy(boost::math::concepts::real_concept(0.), "real_concept"); // Test real concept.
152 } // BOOST_AUTO_TEST_CASE( test_main )