diff --git a/hash/test/extra/Jamfile.v2 b/hash/test/extra/Jamfile.v2 new file mode 100644 index 0000000..243c1b1 --- /dev/null +++ b/hash/test/extra/Jamfile.v2 @@ -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 diff --git a/hash/test/extra/check_float_funcs.cpp b/hash/test/extra/check_float_funcs.cpp new file mode 100644 index 0000000..a937082 --- /dev/null +++ b/hash/test/extra/check_float_funcs.cpp @@ -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 +#include +#include +#include + +namespace test +{ + template + struct check_return_type + { + template + static void equals(T2) + { + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + template + static void equals_ref(T2&) + { + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + + template + static void convertible(T2) + { + BOOST_STATIC_ASSERT((boost::is_convertible::value)); + } + }; +} + +int main() { + float f = 0; + double d = 0; + long double l = 0; + + test::check_return_type::equals(std::ldexp(f, 0)); + test::check_return_type::equals(std::ldexp(d, 0)); + test::check_return_type::equals(std::ldexp(l, 0)); + + int dummy = 0; + + test::check_return_type::equals(std::frexp(f, &dummy)); + test::check_return_type::equals(std::frexp(d, &dummy)); + test::check_return_type::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