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_0F1.hpp"
7
8 #include <boost/multiprecision/cpp_bin_float.hpp>
9 #include <boost/multiprecision/cpp_dec_float.hpp>
10
expected_results()11 void expected_results()
12 {
13 //
14 // Define the max and mean errors expected for
15 // various compilers and platforms.
16 //
17 const char* largest_type;
18 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
19 if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
20 {
21 largest_type = "(long\\s+)?double|real_concept|cpp_bin_float_quad|dec_40";
22 }
23 else
24 {
25 largest_type = "long double|real_concept|cpp_bin_float_quad|dec_40";
26 }
27 #else
28 largest_type = "(long\\s+)?double|cpp_bin_float_quad|dec_40";
29 #endif
30
31 add_expected_result(
32 ".*", // compiler
33 ".*", // stdlib
34 ".*", // platform
35 largest_type, // test type(s)
36 "Integer.*", // test data group
37 ".*", 300, 100); // test function
38 add_expected_result(
39 ".*", // compiler
40 ".*", // stdlib
41 ".*", // platform
42 largest_type, // test type(s)
43 "Real.*", // test data group
44 ".*", 2000, 1000); // test function
45
46 add_expected_result(
47 ".*", // compiler
48 ".*", // stdlib
49 ".*", // platform
50 largest_type, // test type(s)
51 "Large.*", // test data group
52 ".*", 400, 100); // test function
53
54
55 //
56 // Finish off by printing out the compiler/stdlib/platform names,
57 // we do this to make it easier to mark up expected error rates.
58 //
59 std::cout << "Tests run with " << BOOST_COMPILER << ", "
60 << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
61 }
62
BOOST_AUTO_TEST_CASE(test_main)63 BOOST_AUTO_TEST_CASE( test_main )
64 {
65 expected_results();
66 BOOST_MATH_CONTROL_FP;
67
68 #if !defined(TEST) || (TEST == 1)
69 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
70 test_spots(0.0F, "float");
71 #endif
72 test_spots(0.0, "double");
73 #endif
74
75 #if !defined(TEST) || (TEST == 2)
76 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
77 test_spots(0.0L, "long double");
78 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
79 test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
80 #endif
81 #endif
82 #endif
83 #if !defined(TEST) || (TEST == 3)
84 test_spots(boost::multiprecision::cpp_bin_float_quad(), "cpp_bin_float_quad");
85 #endif
86 #if !defined(TEST) || (TEST == 4)
87 typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<40> > dec_40;
88 test_spots(dec_40(), "dec_40");
89 #endif
90 }
91
92
93
94