From e0737c56c1e384e05064a0c6e1ac46979371041b Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 19 Dec 2018 22:58:32 +0100 Subject: New upstream version 2.0.0+repack --- boost/libs/math/test/test_policy_9.cpp | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 boost/libs/math/test/test_policy_9.cpp (limited to 'boost/libs/math/test/test_policy_9.cpp') diff --git a/boost/libs/math/test/test_policy_9.cpp b/boost/libs/math/test/test_policy_9.cpp new file mode 100644 index 00000000..2e1826df --- /dev/null +++ b/boost/libs/math/test/test_policy_9.cpp @@ -0,0 +1,70 @@ +#define BOOST_TEST_MAIN +// Copyright John Maddock 2007. + +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +void test() +{ + using namespace boost::math::policies; + using namespace boost; + +#if !defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_MATH_DISABLE_CONSTEXPR) + + constexpr auto p1 = make_policy(); + constexpr auto p2 = make_policy(promote_double()); + constexpr auto p3 = make_policy(domain_error(), pole_error(), overflow_error(), underflow_error(), + denorm_error(), evaluation_error(), rounding_error(), indeterminate_result_error()); + constexpr auto p4 = make_policy(promote_float(), promote_double(), assert_undefined(), discrete_quantile(), + digits10<10>(), max_series_iterations<100>(), max_root_iterations<20>()); + constexpr auto p5 = make_policy(digits2<20>()); + + constexpr int d = digits >() + digits_base10 >(); + constexpr unsigned long s = get_max_series_iterations >(); + constexpr unsigned long r = get_max_root_iterations >(); + + constexpr double ep = get_epsilon >(); + constexpr double ep2 = get_epsilon > >(); + + constexpr auto p6 = make_policy(domain_error(), pole_error(), overflow_error(), underflow_error(), + denorm_error(), evaluation_error(), rounding_error(), indeterminate_result_error()); + + constexpr double r1 = raise_domain_error("foo", "Out of range", 0.0, p6); + constexpr double r2 = raise_pole_error("func", "msg", 0.0, p6); + constexpr double r3 = raise_overflow_error("func", "msg", p6); + constexpr double r4 = raise_overflow_error("func", "msg", 0.0, p6); + constexpr double r5 = raise_underflow_error("func", "msg", p6); + constexpr double r6 = raise_denorm_error("func", "msg", 0.0, p6); + constexpr double r7 = raise_evaluation_error("func", "msg", 0.0, p6); + constexpr float r8 = raise_rounding_error("func", "msg", 0.0, 0.0f, p6); + constexpr float r9 = raise_indeterminate_result_error("func", "msg", 0.0, 0.0f, p6); + +#endif + +#ifndef BOOST_NO_CXX11_NOEXCEPT + + static_assert(noexcept(make_policy()), "This expression should be noexcept"); + static_assert(noexcept(make_policy(promote_double())), "This expression should be noexcept"); + static_assert(noexcept(make_policy(domain_error(), pole_error(), overflow_error(), underflow_error(), + denorm_error(), evaluation_error(), rounding_error(), indeterminate_result_error())), "This expression should be noexcept"); + static_assert(noexcept(make_policy(promote_float(), promote_double(), assert_undefined(), discrete_quantile(), + digits10<10>(), max_series_iterations<100>(), max_root_iterations<20>())), "This expression should be noexcept"); + + static_assert(noexcept(digits >() + digits_base10 >()), "This expression should be noexcept"); + static_assert(noexcept(get_max_series_iterations >()), "This expression should be noexcept"); + static_assert(noexcept(get_max_root_iterations >()), "This expression should be noexcept"); + + static_assert(noexcept(get_epsilon >()), "This expression should be noexcept"); + +#endif + +} // BOOST_AUTO_TEST_CASE( test_main ) + + + -- cgit v1.2.3