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