• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>
10 #include <boost/type_traits/is_same.hpp>
11 #define BOOST_TEST_MAIN
12 #include <boost/test/unit_test.hpp> // for test_main
13 #include <iostream>
14 
15 template <class P1, class P2>
check_same(const P1 &,const P2 &)16 bool check_same(const P1&, const P2&)
17 {
18    if(!boost::is_same<P1, P2>::value)
19    {
20       std::cout << "P1 = " << typeid(P1).name() << std::endl;
21       std::cout << "P2 = " << typeid(P2).name() << std::endl;
22    }
23    return boost::is_same<P1, P2>::value;
24 }
25 
26 
BOOST_AUTO_TEST_CASE(test_main)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 
45