• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  (C) Copyright John Maddock 2014.
2 //  Use, modification and distribution are subject to the
3 //  Boost Software License, Version 1.0. (See accompanying file
4 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #include <pch_light.hpp>
7 #include "test_polygamma.hpp"
8 //#include <boost/cstdfloat.hpp>
9 
expected_results()10 void expected_results()
11 {
12    //
13    // Define the max and mean errors expected for
14    // various compilers and platforms.
15    //
16    const char* largest_type;
17 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
18    if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
19    {
20       largest_type = "(long\\s+)?double|real_concept";
21    }
22    else
23    {
24       largest_type = "long double|real_concept";
25    }
26 #else
27    largest_type = "(long\\s+)?double|real_concept";
28 #endif
29 
30    add_expected_result(
31       ".*",                          // compiler
32       ".*",                          // stdlib
33       ".*",                          // platform
34       largest_type,                  // test type(s)
35       ".*large arguments",           // test data group
36       ".*", 400, 200);               // test function
37    add_expected_result(
38       ".*",                          // compiler
39       ".*",                          // stdlib
40       ".*",                          // platform
41       largest_type,                  // test type(s)
42       ".*negative.*",                // test data group
43       ".*", 800, 500);               // test function
44 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
45    if((std::numeric_limits<long double>::digits > std::numeric_limits<double>::digits)
46       && (std::numeric_limits<long double>::digits - std::numeric_limits<double>::digits < 20))
47    {
48       add_expected_result(
49          ".*",                          // compiler
50          ".*",                          // stdlib
51          ".*",                          // platform
52          "double",                      // test type(s)
53          ".*bug cases.*",               // test data group
54          ".*", 100, 30);                // test function
55    }
56 #endif
57    add_expected_result(
58       ".*",                          // compiler
59       ".*",                          // stdlib
60       ".*",                          // platform
61       largest_type,                  // test type(s)
62       ".*bug cases.*",               // test data group
63       ".*", 100000, 50000);          // test function
64    add_expected_result(
65       ".*",                          // compiler
66       ".*",                          // stdlib
67       ".*",                          // platform
68       largest_type,                  // test type(s)
69       ".*",                          // test data group
70       ".*", 40, 10);                 // test function
71    //
72    // Finish off by printing out the compiler/stdlib/platform names,
73    // we do this to make it easier to mark up expected error rates.
74    //
75    std::cout << "Tests run with " << BOOST_COMPILER << ", "
76       << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
77 }
78 
BOOST_AUTO_TEST_CASE(test_main)79 BOOST_AUTO_TEST_CASE( test_main )
80 {
81    expected_results();
82    BOOST_MATH_CONTROL_FP;
83 
84    test_polygamma(0.0F, "float");
85    test_polygamma(0.0, "double");
86 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
87    test_polygamma(0.0L, "long double");
88    test_polygamma(boost::math::concepts::real_concept(0.1), "real_concept");
89 #endif
90 #ifdef BOOST_FLOAT128_C
91    //test_polygamma(BOOST_FLOAT128_C(0.0), "float128_t");
92 #endif
93 }
94 
95 
96 
97