• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  Copyright John Maddock 2015
2 
3 //  Use, modification and distribution are subject to the
4 //  Boost Software License, Version 1.0. (See accompanying file
5 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 
7 #include <pch_light.hpp>
8 #include "test_jacobi_zeta.hpp"
9 
10 //
11 // DESCRIPTION:
12 // ~~~~~~~~~~~~
13 //
14 // This file tests the Elliptic Integral D[phi|k].
15 // There are two sets of tests, spot
16 // tests which compare our results with selected values computed
17 // using the online special function calculator at
18 // functions.wolfram.com, while the bulk of the accuracy tests
19 // use values generated with NTL::RR at 1000-bit precision
20 // and our generic versions of these functions.
21 //
22 // Note that when this file is first run on a new platform many of
23 // these tests will fail: the default accuracy is 1 epsilon which
24 // is too tight for most platforms.  In this situation you will
25 // need to cast a human eye over the error rates reported and make
26 // a judgement as to whether they are acceptable.  Either way please
27 // report the results to the Boost mailing list.  Acceptable rates of
28 // error are marked up below as a series of regular expressions that
29 // identify the compiler/stdlib/platform/data-type/test-data/test-function
30 // along with the maximum expected peek and RMS mean errors for that
31 // test.
32 //
33 
expected_results()34 void expected_results()
35 {
36    //
37    // Define the max and mean errors expected for
38    // various compilers and platforms.
39    //
40    const char* largest_type;
41 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
42    if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
43    {
44       largest_type = "(long\\s+)?double";
45    }
46    else
47    {
48       largest_type = "long double";
49    }
50 #else
51    largest_type = "(long\\s+)?double";
52 #endif
53 
54    //
55    // Catch all cases come last:
56    //
57    add_expected_result(
58       ".*",                          // compiler
59       ".*",                          // stdlib
60       ".*",                          // platform
61       largest_type,                  // test type(s)
62       ".*",      // test data group
63       ".*", 15, 6);  // test function
64    add_expected_result(
65       ".*",                          // compiler
66       ".*",                          // stdlib
67       ".*",                          // platform
68       "real_concept",                  // test type(s)
69       ".*",      // test data group
70       ".*", 15, 6);  // 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 
79 
BOOST_AUTO_TEST_CASE(test_main)80 BOOST_AUTO_TEST_CASE( test_main )
81 {
82     expected_results();
83     BOOST_MATH_CONTROL_FP;
84 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
85     test_spots(0.0F, "float");
86 #endif
87     test_spots(0.0, "double");
88 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
89     test_spots(0.0L, "long double");
90 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
91     test_spots(boost::math::concepts::real_concept(0), "real_concept");
92 #endif
93 #else
94    std::cout << "<note>The long double tests have been disabled on this platform "
95       "either because the long double overloads of the usual math functions are "
96       "not available at all, or because they are too inaccurate for these tests "
97       "to pass.</note>" << std::endl;
98 #endif
99 
100 }
101