|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81679 - trunk/libs/functional/hash/test
From: dnljms_at_[hidden]
Date: 2012-12-02 16:12:39
Author: danieljames
Date: 2012-12-02 16:12:38 EST (Sun, 02 Dec 2012)
New Revision: 81679
URL: http://svn.boost.org/trac/boost/changeset/81679
Log:
Hash: Avoid some intel warnings in tests.
It doesn't have the GCC warning pragma, and doesn't like compiling the integer
tests with floats (used to compile them, but never use them).
Text files modified:
trunk/libs/functional/hash/test/hash_complex_test.cpp | 2 +-
trunk/libs/functional/hash/test/hash_float_test.hpp | 2 +-
trunk/libs/functional/hash/test/hash_number_test.cpp | 39 +++++++++++++++++++++++++++------------
3 files changed, 29 insertions(+), 14 deletions(-)
Modified: trunk/libs/functional/hash/test/hash_complex_test.cpp
==============================================================================
--- trunk/libs/functional/hash/test/hash_complex_test.cpp (original)
+++ trunk/libs/functional/hash/test/hash_complex_test.cpp 2012-12-02 16:12:38 EST (Sun, 02 Dec 2012)
@@ -35,7 +35,7 @@
#endif
#endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
Modified: trunk/libs/functional/hash/test/hash_float_test.hpp
==============================================================================
--- trunk/libs/functional/hash/test/hash_float_test.hpp (original)
+++ trunk/libs/functional/hash/test/hash_float_test.hpp 2012-12-02 16:12:38 EST (Sun, 02 Dec 2012)
@@ -30,7 +30,7 @@
#endif
#endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
Modified: trunk/libs/functional/hash/test/hash_number_test.cpp
==============================================================================
--- trunk/libs/functional/hash/test/hash_number_test.cpp (original)
+++ trunk/libs/functional/hash/test/hash_number_test.cpp 2012-12-02 16:12:38 EST (Sun, 02 Dec 2012)
@@ -16,6 +16,7 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/functional/hash/detail/limits.hpp>
+#include <boost/utility/enable_if.hpp>
#include "./compile_time.hpp"
@@ -26,11 +27,35 @@
#pragma warning(disable:4310) // cast truncates constant value
#endif
-#if defined(__GNUC__)
+#if defined(__GNUC__) && !defined(BOOST_INTEL_CXX_VERSION)
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
template <class T>
+void numeric_extra_tests(typename
+ boost::enable_if_c<boost::hash_detail::limits<T>::is_integer,
+ void*>::type = 0)
+{
+ typedef boost::hash_detail::limits<T> limits;
+
+ if(limits::is_signed ||
+ limits::digits <= boost::hash_detail::limits<std::size_t>::digits)
+ {
+ BOOST_TEST(HASH_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5));
+ }
+ BOOST_TEST(HASH_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u));
+ BOOST_TEST(HASH_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u));
+ BOOST_TEST(HASH_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u));
+}
+
+template <class T>
+void numeric_extra_tests(typename
+ boost::disable_if_c<boost::hash_detail::limits<T>::is_integer,
+ void*>::type = 0)
+{
+}
+
+template <class T>
void numeric_test(T*)
{
typedef boost::hash_detail::limits<T> limits;
@@ -55,17 +80,7 @@
BOOST_TEST(x1(T(10)) == HASH_NAMESPACE::hash_value(T(10)));
BOOST_TEST(x1(T(25)) == HASH_NAMESPACE::hash_value(T(25)));
- if (limits::is_integer)
- {
- if(limits::is_signed ||
- limits::digits <= boost::hash_detail::limits<std::size_t>::digits)
- {
- BOOST_TEST(HASH_NAMESPACE::hash_value(T(-5)) == (std::size_t)T(-5));
- }
- BOOST_TEST(HASH_NAMESPACE::hash_value(T(0)) == (std::size_t)T(0u));
- BOOST_TEST(HASH_NAMESPACE::hash_value(T(10)) == (std::size_t)T(10u));
- BOOST_TEST(HASH_NAMESPACE::hash_value(T(25)) == (std::size_t)T(25u));
- }
+ numeric_extra_tests<T>();
#endif
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk