Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / math / test / powm1_sqrtp1m1_test.cpp
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 <pch_light.hpp>
7
8 #include <boost/math/concepts/real_concept.hpp>
9 #define BOOST_TEST_MAIN
10 #include <boost/test/unit_test.hpp>
11 #include <boost/test/tools/floating_point_comparison.hpp>
12 #include <boost/math/special_functions/math_fwd.hpp>
13 #include <boost/math/tools/test.hpp>
14 #include "powm1_sqrtp1m1_test.hpp"
15
16 //
17 // DESCRIPTION:
18 // ~~~~~~~~~~~~
19 //
20 // This file tests the functions powm1 and sqrt1pm1.  
21 // The accuracy tests
22 // use values generated with NTL::RR at 1000-bit precision
23 // and our generic versions of these functions.
24 //
25 // Note that when this file is first run on a new platform many of
26 // these tests will fail: the default accuracy is 1 epsilon which
27 // is too tight for most platforms.  In this situation you will 
28 // need to cast a human eye over the error rates reported and make
29 // a judgement as to whether they are acceptable.  Either way please
30 // report the results to the Boost mailing list.  Acceptable rates of
31 // error are marked up below as a series of regular expressions that
32 // identify the compiler/stdlib/platform/data-type/test-data/test-function
33 // along with the maximum expected peek and RMS mean errors for that
34 // test.
35 //
36
37 void expected_results()
38 {
39    //
40    // Define the max and mean errors expected for
41    // various compilers and platforms.
42    //
43    add_expected_result(
44       ".*",                          // compiler
45       ".*",                          // stdlib
46       ".*",                          // platform
47       ".*",                          // test type(s)
48       ".*",                          // test data group
49       ".*", 5, 2);                   // test function
50
51    //
52    // Finish off by printing out the compiler/stdlib/platform names,
53    // we do this to make it easier to mark up expected error rates.
54    //
55    std::cout << "Tests run with " << BOOST_COMPILER << ", " 
56       << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
57 }
58
59 BOOST_AUTO_TEST_CASE( test_main )
60 {
61    expected_results();
62    BOOST_MATH_CONTROL_FP;
63    test_powm1_sqrtp1m1(1.0F, "float");
64    test_powm1_sqrtp1m1(1.0, "double");
65 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
66    test_powm1_sqrtp1m1(1.0L, "long double");
67 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
68    test_powm1_sqrtp1m1(boost::math::concepts::real_concept(), "real_concept");
69 #endif
70 #else
71    std::cout << "<note>The long double tests have been disabled on this platform "
72       "either because the long double overloads of the usual math functions are "
73       "not available at all, or because they are too inaccurate for these tests "
74       "to pass.</note>" << std::endl;
75 #endif
76 }
77
78