]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | // Copyright John Maddock 2007. | |
3 | ||
4 | // Use, modification and distribution are subject to the | |
5 | // Boost Software License, Version 1.0. | |
6 | // (See accompanying file LICENSE_1_0.txt | |
7 | // or copy at http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | #include <boost/math/policies/policy.hpp> | |
7c673cae FG |
10 | #define BOOST_TEST_MAIN |
11 | #include <boost/test/unit_test.hpp> // for test_main | |
12 | #include <iostream> | |
1e59de90 | 13 | #include <type_traits> |
7c673cae FG |
14 | |
15 | template <class P1, class P2> | |
16 | bool check_same(const P1&, const P2&) | |
17 | { | |
1e59de90 | 18 | if(!std::is_same<P1, P2>::value) |
7c673cae FG |
19 | { |
20 | std::cout << "P1 = " << typeid(P1).name() << std::endl; | |
21 | std::cout << "P2 = " << typeid(P2).name() << std::endl; | |
22 | } | |
1e59de90 | 23 | return std::is_same<P1, P2>::value; |
7c673cae FG |
24 | } |
25 | ||
26 | ||
27 | BOOST_AUTO_TEST_CASE( test_main ) | |
28 | { | |
29 | using namespace boost::math::policies; | |
30 | using namespace boost; | |
31 | ||
32 | BOOST_CHECK(check_same(make_policy(), policy<>())); | |
33 | BOOST_CHECK(check_same(make_policy(denorm_error<ignore_error>()), normalise<policy<denorm_error<ignore_error> > >::type())); | |
34 | BOOST_CHECK(check_same(make_policy(digits2<20>()), normalise<policy<digits2<20> > >::type())); | |
35 | BOOST_CHECK(check_same(make_policy(promote_float<false>()), normalise<policy<promote_float<false> > >::type())); | |
36 | BOOST_CHECK(check_same(make_policy(domain_error<ignore_error>()), normalise<policy<domain_error<ignore_error> > >::type())); | |
37 | BOOST_CHECK(check_same(make_policy(pole_error<ignore_error>()), normalise<policy<pole_error<ignore_error> > >::type())); | |
38 | BOOST_CHECK(check_same(make_policy(indeterminate_result_error<ignore_error>()), normalise<policy<indeterminate_result_error<ignore_error> > >::type())); | |
39 | ||
40 | ||
41 | } // BOOST_AUTO_TEST_CASE( test_main ) | |
42 | ||
43 | ||
44 |