1 // (C) Copyright John Maddock 2006.
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 "test_1F1_log.hpp"
7
8 #include <boost/multiprecision/cpp_bin_float.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|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
21 }
22 else
23 {
24 largest_type = "long double|real_concept|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
25 }
26 #else
27 largest_type = "(long\\s+)?double";
28 #endif
29
30 add_expected_result(
31 ".*", // compiler
32 ".*", // stdlib
33 ".*", // platform
34 "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
35 "Integer a values", // test data group
36 ".*", 25000, 800); // test function
37 add_expected_result(
38 ".*", // compiler
39 ".*", // stdlib
40 ".*", // platform
41 "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
42 "Large.*", // test data group
43 ".*", 500000, 20000); // test function
44 add_expected_result(
45 ".*", // compiler
46 ".*", // stdlib
47 ".*", // platform
48 "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
49 "Small.*", // test data group
50 ".*", 2000, 200); // test function
51
52 add_expected_result(
53 ".*", // compiler
54 ".*", // stdlib
55 ".*", // platform
56 "dec_40", // test type(s)
57 "Integer a values", // test data group
58 ".*", 12000, 800); // test function
59 add_expected_result(
60 ".*", // compiler
61 ".*", // stdlib
62 ".*", // platform
63 "dec_40", // test type(s)
64 "Large.*", // test data group
65 ".*", 20000000L, 600000L); // test function
66 add_expected_result(
67 ".*", // compiler
68 ".*", // stdlib
69 ".*", // platform
70 "dec_40", // test type(s)
71 "Small.*", // test data group
72 ".*", 1000, 300); // test function
73
74 #if (LDBL_MANT_DIG < DBL_MANT_DIG * 2) && (LDBL_MANT_DIG != DBL_MANT_DIG)
75 //
76 // long double has only a little extra precision and errors may creep
77 // into the double results:
78 //
79 add_expected_result(
80 ".*", // compiler
81 ".*", // stdlib
82 ".*", // platform
83 "double", // test type(s)
84 "Integer a values", // test data group
85 ".*", 5, 3); // test function
86
87 add_expected_result(
88 ".*", // compiler
89 ".*", // stdlib
90 ".*", // platform
91 "double", // test type(s)
92 "Small.*", // test data group
93 ".*", 5, 3); // test function
94
95 add_expected_result(
96 ".*", // compiler
97 ".*", // stdlib
98 ".*", // platform
99 "double", // test type(s)
100 "Large.*", // test data group
101 ".*", 40, 20); // test function
102 add_expected_result(
103 ".*", // compiler
104 ".*", // stdlib
105 ".*", // platform
106 "double", // test type(s)
107 "Bug.*", // test data group
108 ".*", 300, 50); // test function
109
110 #endif
111
112 add_expected_result(
113 ".*", // compiler
114 ".*", // stdlib
115 ".*", // platform
116 largest_type, // test type(s)
117 "Integer a values", // test data group
118 ".*", 16000, 600); // test function
119
120 add_expected_result(
121 ".*", // compiler
122 ".*", // stdlib
123 ".*", // platform
124 largest_type, // test type(s)
125 "Small.*", // test data group
126 ".*", 2000, 200); // test function
127
128 add_expected_result(
129 ".*", // compiler
130 ".*", // stdlib
131 ".*", // platform
132 largest_type, // test type(s)
133 "Large.*", // test data group
134 ".*", 400000, 8000); // test function
135 add_expected_result(
136 ".*", // compiler
137 ".*", // stdlib
138 ".*", // platform
139 "dec_40", // test type(s)
140 "Bug cases.*", // test data group
141 ".*", 2200000, 400000); // test function
142 add_expected_result(
143 ".*", // compiler
144 ".*", // stdlib
145 ".*", // platform
146 largest_type, // test type(s)
147 "Bug cases.*", // test data group
148 ".*", 1500000, 400000); // test function
149
150 //
151 // Finish off by printing out the compiler/stdlib/platform names,
152 // we do this to make it easier to mark up expected error rates.
153 //
154 std::cout << "Tests run with " << BOOST_COMPILER << ", "
155 << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
156 }
157
BOOST_AUTO_TEST_CASE(test_main)158 BOOST_AUTO_TEST_CASE( test_main )
159 {
160 expected_results();
161 BOOST_MATH_CONTROL_FP;
162
163 #if !defined(TEST) || (TEST == 1)
164 test_hypergeometric_mellin_transform<double>();
165 test_hypergeometric_laplace_transform<double>();
166 #endif
167
168 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
169 #if !defined(TEST) || (TEST == 2)
170 test_spots(0.0F, "float");
171 #endif
172 #endif
173 #if !defined(TEST) || (TEST == 3)
174 test_spots(0.0, "double");
175 #endif
176 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
177 #if (!defined(TEST) || (TEST == 4)) && (DBL_MAX_EXP != LDBL_MAX_EXP)
178 test_spots(0.0L, "long double");
179 #endif
180 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
181 #if !defined(TEST) || (TEST == 5)
182 test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
183 #endif
184 #endif
185 #endif
186 #if !defined(TEST) || (TEST == 6)
187 test_spots(boost::multiprecision::cpp_bin_float_quad(), "cpp_bin_float_quad");
188 #endif
189 #if !defined(TEST) || (TEST == 7)
190 typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<40> > dec_40;
191 test_spots(dec_40(), "dec_40");
192 #endif
193 }
194
195