mirror of
https://github.com/boostorg/container_hash.git
synced 2026-01-26 17:12:18 +01:00
in hash and seperate out some of the detail headers. Merged revisions 53159-53161,53167-53169,53175,53185,53205,53247-53248,53254 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r53159 | danieljames | 2009-05-21 22:21:11 +0100 (Thu, 21 May 2009) | 1 line Move the hash limits workaround into its own file. ........ r53160 | danieljames | 2009-05-21 22:21:44 +0100 (Thu, 21 May 2009) | 1 line Move the two different hash float implementation into their own header. ........ r53161 | danieljames | 2009-05-21 22:22:04 +0100 (Thu, 21 May 2009) | 1 line Try to automatically detect which float functions are available. ........ r53167 | danieljames | 2009-05-22 07:00:56 +0100 (Fri, 22 May 2009) | 1 line Fix a typo. ........ r53168 | danieljames | 2009-05-22 07:01:19 +0100 (Fri, 22 May 2009) | 3 lines Spell out exactly which functions can be used with which types. I was hitting some ambiguity errors when the function was for the wrong type. ........ r53169 | danieljames | 2009-05-22 07:01:35 +0100 (Fri, 22 May 2009) | 1 line Some STLport fixes for hash. ........ r53175 | danieljames | 2009-05-22 14:35:56 +0100 (Fri, 22 May 2009) | 2 lines Rename struct to avoid using 'type::'type' which confuses some compilers. ........ r53185 | danieljames | 2009-05-22 20:00:35 +0100 (Fri, 22 May 2009) | 1 line Explicitly qualify 'none' to avoid confusion with boost::none. ........ r53205 | danieljames | 2009-05-23 16:21:38 +0100 (Sat, 23 May 2009) | 4 lines Try to deal with macros for frexpl and ldexpl. The error message for msvc-9.0~wm5~stlport5.2 suggests that frexpl and ldexpl are macros. ........ r53247 | danieljames | 2009-05-25 14:45:16 +0100 (Mon, 25 May 2009) | 4 lines Check for float functions with less templates. The only template mechanism now used is full specialization, so this should hopefully be more portable to compilers we don't test. ........ r53248 | danieljames | 2009-05-25 15:27:00 +0100 (Mon, 25 May 2009) | 1 line Fix a couple of clumsy errors in the last commit. ........ r53254 | danieljames | 2009-05-25 20:44:52 +0100 (Mon, 25 May 2009) | 1 line Hash change log. ........ [SVN r53361]
62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
|
|
// Copyright 2005-2009 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 "./config.hpp"
|
|
|
|
#ifdef TEST_STD_INCLUDES
|
|
# include <functional>
|
|
#else
|
|
# include <boost/functional/hash.hpp>
|
|
#endif
|
|
|
|
#include <boost/detail/lightweight_test.hpp>
|
|
|
|
#include <boost/mpl/assert.hpp>
|
|
#include <boost/type_traits/is_base_and_derived.hpp>
|
|
|
|
#include "./compile_time.hpp"
|
|
|
|
void void_func1() { static int x = 1; ++x; }
|
|
void void_func2() { static int x = 2; --x; }
|
|
int int_func1(int) { return 0; }
|
|
int int_func2(int) { return 1; }
|
|
|
|
void function_pointer_tests()
|
|
{
|
|
compile_time_tests((void(**)()) 0);
|
|
compile_time_tests((int(**)(int)) 0);
|
|
|
|
HASH_NAMESPACE::hash<void(*)()> hasher_void;
|
|
HASH_NAMESPACE::hash<int(*)(int)> hasher_int;
|
|
|
|
BOOST_TEST(&void_func1 != &void_func2);
|
|
BOOST_TEST(&int_func1 != &int_func2);
|
|
|
|
BOOST_TEST(hasher_void(0) == hasher_void(0));
|
|
BOOST_TEST(hasher_void(&void_func1) == hasher_void(&void_func1));
|
|
BOOST_TEST(hasher_void(&void_func1) != hasher_void(&void_func2));
|
|
BOOST_TEST(hasher_void(&void_func1) != hasher_void(0));
|
|
BOOST_TEST(hasher_int(0) == hasher_int(0));
|
|
BOOST_TEST(hasher_int(&int_func1) == hasher_int(&int_func1));
|
|
BOOST_TEST(hasher_int(&int_func1) != hasher_int(&int_func2));
|
|
BOOST_TEST(hasher_int(&int_func1) != hasher_int(0));
|
|
#if defined(TEST_EXTENSIONS)
|
|
BOOST_TEST(hasher_void(&void_func1)
|
|
== HASH_NAMESPACE::hash_value(&void_func1));
|
|
BOOST_TEST(hasher_int(&int_func1)
|
|
== HASH_NAMESPACE::hash_value(&int_func1));
|
|
|
|
// This isn't specified in Peter's proposal:
|
|
BOOST_TEST(hasher_void(0) == 0);
|
|
#endif
|
|
}
|
|
|
|
int main()
|
|
{
|
|
function_pointer_tests();
|
|
|
|
return boost::report_errors();
|
|
}
|