From 60676e99e8b4825f1f4720e132689335a1762c10 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 22 Feb 2021 18:49:19 +0000 Subject: [PATCH] Slight increase in policy testing. --- test/Jamfile.v2 | 1 + test/test_policy_10.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 test/test_policy_10.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 3b39e3bcb..dedec3110 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -944,6 +944,7 @@ test-suite misc : [ run test_policy_7.cpp ../../test/build//boost_unit_test_framework ] [ run test_policy_8.cpp ../../test/build//boost_unit_test_framework ] [ compile test_policy_9.cpp ] + [ run test_policy_10.cpp ../../test/build//boost_unit_test_framework ] [ run test_policy_sf.cpp ../../test/build//boost_unit_test_framework ] [ run test_long_double_support.cpp ../../test/build//boost_unit_test_framework : : : [ check-target-builds ../config//has_long_double_support "long double support" : : no ] ] diff --git a/test/test_policy_10.cpp b/test/test_policy_10.cpp new file mode 100644 index 000000000..ce53076bf --- /dev/null +++ b/test/test_policy_10.cpp @@ -0,0 +1,38 @@ + +// 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 +#define BOOST_TEST_MAIN +#include // for test_main +#include +#include + +template +bool check_same(const P1&, const P2&) +{ + if(!std::is_same::value) + { + std::cout << "P1 = " << typeid(P1).name() << std::endl; + std::cout << "P2 = " << typeid(P2).name() << std::endl; + } + return std::is_same::value; +} + + +BOOST_AUTO_TEST_CASE( test_main ) +{ + using namespace boost::math::policies; + using namespace boost; + + BOOST_CHECK(check_same(make_policy(denorm_error(), digits2<20>()), make_policy(digits2<20>(), denorm_error()))); + BOOST_CHECK(check_same(make_policy(denorm_error(), promote_float()), make_policy(promote_float(), denorm_error()))); + BOOST_CHECK(check_same(make_policy(denorm_error(), indeterminate_result_error(), promote_float()), make_policy(indeterminate_result_error(), promote_float(), denorm_error()))); +} // BOOST_AUTO_TEST_CASE( test_main ) + + +