|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81210 - in trunk: libs/functional/hash/test/extra status
From: dnljms_at_[hidden]
Date: 2012-11-05 13:33:55
Author: danieljames
Date: 2012-11-05 13:33:54 EST (Mon, 05 Nov 2012)
New Revision: 81210
URL: http://svn.boost.org/trac/boost/changeset/81210
Log:
Hash: Extra test to check different platform's floating point functions.
Added:
trunk/libs/functional/hash/test/extra/
trunk/libs/functional/hash/test/extra/Jamfile.v2 (contents, props changed)
trunk/libs/functional/hash/test/extra/check_float_funcs.cpp (contents, props changed)
Text files modified:
trunk/status/Jamfile.v2 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Added: trunk/libs/functional/hash/test/extra/Jamfile.v2
==============================================================================
--- (empty file)
+++ trunk/libs/functional/hash/test/extra/Jamfile.v2 2012-11-05 13:33:54 EST (Mon, 05 Nov 2012)
@@ -0,0 +1,13 @@
+
+# Copyright 2012 Daniel James.
+# Distributed under 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)
+
+import testing ;
+
+build-project .. ;
+
+test-suite functional/hash/config
+ :
+ [ compile check_float_funcs.cpp ]
+ ;
\ No newline at end of file
Added: trunk/libs/functional/hash/test/extra/check_float_funcs.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/functional/hash/test/extra/check_float_funcs.cpp 2012-11-05 13:33:54 EST (Mon, 05 Nov 2012)
@@ -0,0 +1,58 @@
+
+// Copyright 2012 Daniel James.
+// Distributed under 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 <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <cmath>
+
+namespace test
+{
+ template <class T1>
+ struct check_return_type
+ {
+ template <class T2>
+ static void equals(T2)
+ {
+ BOOST_STATIC_ASSERT((boost::is_same<T1, T2>::value));
+ }
+
+ template <class T2>
+ static void equals_ref(T2&)
+ {
+ BOOST_STATIC_ASSERT((boost::is_same<T1, T2>::value));
+ }
+
+ template <class T2>
+ static void convertible(T2)
+ {
+ BOOST_STATIC_ASSERT((boost::is_convertible<T2, T1>::value));
+ }
+ };
+}
+
+int main() {
+ float f = 0;
+ double d = 0;
+ long double l = 0;
+
+ test::check_return_type<float>::equals(std::ldexp(f, 0));
+ test::check_return_type<double>::equals(std::ldexp(d, 0));
+ test::check_return_type<long double>::equals(std::ldexp(l, 0));
+
+ int dummy = 0;
+
+ test::check_return_type<float>::equals(std::frexp(f, &dummy));
+ test::check_return_type<double>::equals(std::frexp(d, &dummy));
+ test::check_return_type<long double>::equals(std::frexp(l, &dummy));
+
+#if BOOST_HASH_USE_FPCLASSIFY
+
+ int (*fpc1)(float) = std::fpclassify;
+ int (*fpc2)(double) = std::fpclassify;
+ int (*fpc3)(long double) = std::fpclassify;
+
+#endif
+}
\ No newline at end of file
Modified: trunk/status/Jamfile.v2
==============================================================================
--- trunk/status/Jamfile.v2 (original)
+++ trunk/status/Jamfile.v2 2012-11-05 13:33:54 EST (Mon, 05 Nov 2012)
@@ -79,7 +79,7 @@
functional/test # test-suite functional
functional/factory/test # test-suite functional/factory
functional/forward/test # test-suite functional/forward
- functional/hash/test # test-suite functional/hash
+ functional/hash/test/extra # test-suite functional/hash
functional/overloaded_function/test # test-suite func./overloaded_function
function_types/test # test-suite function_types
fusion/test # test-suite fusion
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