1 2 // Copyright 2005-2009 Daniel James. 3 // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #include "./config.hpp" 7 8 #ifdef BOOST_HASH_TEST_STD_INCLUDES 9 # include <functional> 10 #else 11 # include <boost/container_hash/hash.hpp> 12 #endif 13 14 #include <boost/core/lightweight_test.hpp> 15 #include <boost/limits.hpp> 16 #include "./compile_time.hpp" 17 pointer_tests()18void pointer_tests() 19 { 20 compile_time_tests((int**) 0); 21 compile_time_tests((void**) 0); 22 23 BOOST_HASH_TEST_NAMESPACE::hash<int*> x1; 24 BOOST_HASH_TEST_NAMESPACE::hash<int*> x2; 25 26 int int1; 27 int int2; 28 29 BOOST_TEST(x1(0) == x2(0)); 30 BOOST_TEST(x1(&int1) == x2(&int1)); 31 BOOST_TEST(x1(&int2) == x2(&int2)); 32 #if defined(BOOST_HASH_TEST_EXTENSIONS) 33 BOOST_TEST(x1(&int1) == BOOST_HASH_TEST_NAMESPACE::hash_value(&int1)); 34 BOOST_TEST(x1(&int2) == BOOST_HASH_TEST_NAMESPACE::hash_value(&int2)); 35 36 // This isn't specified in Peter's proposal: 37 BOOST_TEST(x1(0) == 0); 38 #endif 39 } 40 main()41int main() 42 { 43 pointer_tests(); 44 return boost::report_errors(); 45 } 46