• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // sp_hash_test2.cpp
3 //
4 // Copyright 2011, 2015 Peter Dimov
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
9 //
10 
11 #include <boost/shared_ptr.hpp>
12 #include <boost/functional/hash.hpp>
13 #include <boost/core/lightweight_test.hpp>
14 
main()15 int main()
16 {
17     boost::hash< boost::shared_ptr<int[]> > hasher;
18 
19     boost::shared_ptr< int[] > p1, p2( p1 ), p3( new int[1] ), p4( p3 ), p5( new int[1] );
20 
21     BOOST_TEST_EQ( p1, p2 );
22     BOOST_TEST_EQ( hasher( p1 ), hasher( p2 ) );
23 
24     BOOST_TEST_NE( p1, p3 );
25     BOOST_TEST_NE( hasher( p1 ), hasher( p3 ) );
26 
27     BOOST_TEST_EQ( p3, p4 );
28     BOOST_TEST_EQ( hasher( p3 ), hasher( p4 ) );
29 
30     BOOST_TEST_NE( p3, p5 );
31     BOOST_TEST_NE( hasher( p3 ), hasher( p5 ) );
32 
33     return boost::report_errors();
34 }
35