From f083968ba6ae18a2e5e23ab87e8b7140cb0a9b96 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 13 Aug 2015 17:53:33 +0100 Subject: [PATCH] Update to use new BOOST_HAS_FLOAT128, plus more tests. --- include/boost/type_traits/is_floating_point.hpp | 4 ++-- test/is_arithmetic_test.cpp | 9 +++++++++ test/is_floating_point_test.cpp | 7 +++++++ test/is_fundamental_test.cpp | 9 +++++++++ test/is_pod_test.cpp | 9 +++++++++ test/is_scalar_test.cpp | 10 ++++++++++ 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/include/boost/type_traits/is_floating_point.hpp b/include/boost/type_traits/is_floating_point.hpp index bc91814..196c900 100755 --- a/include/boost/type_traits/is_floating_point.hpp +++ b/include/boost/type_traits/is_floating_point.hpp @@ -21,9 +21,9 @@ namespace boost { template<> struct is_floating_point : public true_type{}; template<> struct is_floating_point : public true_type{}; - #if defined(_GLIBCXX_USE_FLOAT128) && defined(BOOST_GCC) && !defined(__STRICT_ANSI__) +#if defined(BOOST_HAS_FLOAT128) template<> struct is_floating_point<__float128> : public true_type{}; - #endif +#endif } // namespace boost diff --git a/test/is_arithmetic_test.cpp b/test/is_arithmetic_test.cpp index 41226d3..9192dfc 100644 --- a/test/is_arithmetic_test.cpp +++ b/test/is_arithmetic_test.cpp @@ -151,6 +151,15 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); #endif +#ifdef BOOST_HAS_INT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +#endif + +#ifdef BOOST_HAS_FLOAT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_arithmetic::value, true); +#endif + TT_TEST_END diff --git a/test/is_floating_point_test.cpp b/test/is_floating_point_test.cpp index 3b70b5f..15fec14 100644 --- a/test/is_floating_point_test.cpp +++ b/test/is_floating_point_test.cpp @@ -29,6 +29,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +#ifdef BOOST_HAS_FLOAT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point<__float128>::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_floating_point::value, true); +#endif + // // cases that should not be true: // diff --git a/test/is_fundamental_test.cpp b/test/is_fundamental_test.cpp index a9dce34..0b33444 100644 --- a/test/is_fundamental_test.cpp +++ b/test/is_fundamental_test.cpp @@ -155,6 +155,15 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); #endif +#ifdef BOOST_HAS_INT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +#endif + +#ifdef BOOST_HAS_FLOAT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_fundamental::value, true); +#endif + TT_TEST_END diff --git a/test/is_pod_test.cpp b/test/is_pod_test.cpp index 4f17741..94fd04a 100644 --- a/test/is_pod_test.cpp +++ b/test/is_pod_test.cpp @@ -177,6 +177,15 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); #endif +#ifdef BOOST_HAS_INT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +#endif + +#ifdef BOOST_HAS_FLOAT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod::value, true); +#endif + TT_TEST_END diff --git a/test/is_scalar_test.cpp b/test/is_scalar_test.cpp index 8b22363..99e484c 100644 --- a/test/is_scalar_test.cpp +++ b/test/is_scalar_test.cpp @@ -156,6 +156,16 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); #endif +#ifdef BOOST_HAS_INT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +#endif + +#ifdef BOOST_HAS_FLOAT128 +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_scalar::value, true); +#endif + + TT_TEST_END