Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / multiprecision / test / math / test_bessel_y.cpp
1 ///////////////////////////////////////////////////////////////
2 //  Copyright Christopher Kormanyos 2002 - 2011.
3 //  Copyright 2011 John Maddock. Distributed under the Boost
4 //  Software License, Version 1.0. (See accompanying file
5 //  LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
6 //
7 // This work is based on an earlier work:
8 // "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
9 // in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
10
11 #include "setup.hpp"
12 #include "table_type.hpp"
13
14 #include <boost/math/special_functions/math_fwd.hpp>
15 #include "libs/math/test/test_bessel_y.hpp"
16
17 void expected_results()
18 {
19    //
20    // Define the max and mean errors expected for
21    // various compilers and platforms.
22    //
23    add_expected_result(
24        ".*",                         // compiler
25        ".*",                         // stdlib
26        ".*",                         // platform
27        ".*mpfr_float_backend<18>.*", // test type(s)
28        ".*(Y[nv]|y).*Random.*",      // test data group
29        ".*", 200000, 10000);         // test function
30    add_expected_result(
31        ".*",                    // compiler
32        ".*",                    // stdlib
33        ".*",                    // platform
34        ".*cpp_bin_float.*",     // test type(s)
35        ".*(Y[nv]|y).*Random.*", // test data group
36        ".*", 2000000, 1000000); // test function
37    add_expected_result(
38        ".*",                        // compiler
39        ".*",                        // stdlib
40        ".*",                        // platform
41        ".*mpfr_float_backend<0>.*", // test type(s)
42        ".*(Y[nv]|y).*Random.*",     // test data group
43        ".*", 150000, 15000);        // test function
44    add_expected_result(
45        ".*",                    // compiler
46        ".*",                    // stdlib
47        ".*",                    // platform
48        ".*",                    // test type(s)
49        ".*(Y[nv]|y).*Random.*", // test data group
50        ".*", 70000, 4000);      // test function
51    add_expected_result(
52        ".*",                         // compiler
53        ".*",                         // stdlib
54        ".*",                         // platform
55        ".*mpfr_float_backend<18>.*", // test type(s)
56        ".*Y0.*",                     // test data group
57        ".*", 3000, 2000);            // test function
58    add_expected_result(
59        ".*",                // compiler
60        ".*",                // stdlib
61        ".*",                // platform
62        ".*cpp_bin_float.*", // test type(s)
63        ".*Y0.*",            // test data group
64        ".*", 40000, 20000); // test function
65    add_expected_result(
66        ".*",            // compiler
67        ".*",            // stdlib
68        ".*",            // platform
69        ".*",            // test type(s)
70        ".*Y0.*",        // test data group
71        ".*", 800, 400); // test function
72    add_expected_result(
73        ".*",                         // compiler
74        ".*",                         // stdlib
75        ".*",                         // platform
76        ".*mpfr_float_backend<18>.*", // test type(s)
77        ".*Yn.*",                     // test data group
78        ".*", 400000, 70000);         // test function
79    add_expected_result(
80        ".*",                  // compiler
81        ".*",                  // stdlib
82        ".*",                  // platform
83        ".*cpp_bin_float.*",   // test type(s)
84        ".*Yn.*",              // test data group
85        ".*", 400000, 200000); // test function
86    add_expected_result(
87        ".*",             // compiler
88        ".*",             // stdlib
89        ".*",             // platform
90        ".*",             // test type(s)
91        ".*Yn.*",         // test data group
92        ".*", 1700, 600); // test function
93    add_expected_result(
94        ".*",                         // compiler
95        ".*",                         // stdlib
96        ".*",                         // platform
97        ".*mpfr_float_backend<18>.*", // test type(s)
98        ".*",                         // test data group
99        ".*", 15000, 4000);           // test function
100    add_expected_result(
101        ".*",                // compiler
102        ".*",                // stdlib
103        ".*",                // platform
104        ".*cpp_bin_float.*", // test type(s)
105        ".*",                // test data group
106        ".*", 50000, 20000); // test function
107    add_expected_result(
108        ".*",           // compiler
109        ".*",           // stdlib
110        ".*",           // platform
111        ".*",           // test type(s)
112        ".*",           // test data group
113        ".*", 150, 60); // test function
114    //
115    // Finish off by printing out the compiler/stdlib/platform names,
116    // we do this to make it easier to mark up expected error rates.
117    //
118    std::cout << "Tests run with " << BOOST_COMPILER << ", "
119              << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
120 }
121
122 template <class T>
123 void test(T t, const char* p)
124 {
125    test_bessel(t, p);
126 }
127
128 BOOST_AUTO_TEST_CASE(test_main)
129 {
130    using namespace boost::multiprecision;
131    expected_results();
132    //
133    // Test at:
134    // 18 decimal digits: tests 80-bit long double approximations
135    // 30 decimal digits: tests 128-bit long double approximations
136    // 35 decimal digits: tests arbitrary precision code
137    //
138    ALL_SMALL_TESTS
139 }