1 #define BOOST_TEST_MAIN
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 #include <boost/test/unit_test.hpp> // for test_main
12 #include <iostream>
13
14 template <class P1, class P2>
check_same(const P1 &,const P2 &)15 bool check_same(const P1&, const P2&)
16 {
17 if(!boost::is_same<P1, P2>::value)
18 {
19 std::cout << "P1 = " << typeid(P1).name() << std::endl;
20 std::cout << "P2 = " << typeid(P2).name() << std::endl;
21 }
22 return boost::is_same<P1, P2>::value;
23 }
24
25
BOOST_AUTO_TEST_CASE(test_main)26 BOOST_AUTO_TEST_CASE( test_main )
27 {
28 using namespace boost::math::policies;
29 using namespace boost;
30
31 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::domain_error_type, domain_error<ignore_error> >::value));
32 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value));
33 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::overflow_error_type, overflow_error<ignore_error> >::value));
34 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value));
35 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value));
36 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value));
37 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::indeterminate_result_error_type, indeterminate_result_error<BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY> >::value));
38 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::precision_type, policy<>::precision_type>::value));
39 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::promote_float_type, policy<>::promote_float_type>::value));
40 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value));
41 BOOST_CHECK((is_same<policy<domain_error<ignore_error>, overflow_error<ignore_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value));
42
43
44 } // BOOST_AUTO_TEST_CASE( test_main )
45
46
47
48