• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_EXTENSIONS
9 #  ifdef BOOST_HASH_TEST_STD_INCLUDES
10 #    include <functional>
11 #  else
12 #    include <boost/container_hash/hash.hpp>
13 #  endif
14 #endif
15 
16 #include <boost/core/lightweight_test.hpp>
17 
18 #ifdef BOOST_HASH_TEST_EXTENSIONS
19 
20 #include <vector>
21 
22 using std::vector;
23 #define CONTAINER_TYPE vector
24 #include "./hash_sequence_test.hpp"
25 
26 #endif // BOOST_HASH_TEST_EXTENSIONS
27 
28 namespace vector_bool_tests
29 {
vector_bool_test()30     void vector_bool_test() {
31         std::vector<bool> x_empty1,x_empty2,x1,x1a,x2,x3;
32 
33         x1.push_back(0);
34         x1a.push_back(0);
35         x2.push_back(1);
36         x3.push_back(0);
37         x3.push_back(0);
38 
39         BOOST_HASH_TEST_NAMESPACE::hash<std::vector<bool> > hasher;
40 
41         BOOST_TEST_EQ(hasher(x_empty1), hasher(x_empty1));
42         BOOST_TEST_EQ(hasher(x_empty1), hasher(x_empty2));
43         BOOST_TEST_NE(hasher(x_empty1), hasher(x1));
44         BOOST_TEST_NE(hasher(x_empty1), hasher(x2));
45         BOOST_TEST_NE(hasher(x_empty1), hasher(x3));
46 
47         BOOST_TEST_EQ(hasher(x1), hasher(x1));
48         BOOST_TEST_EQ(hasher(x1), hasher(x1a));
49         BOOST_TEST_NE(hasher(x1), hasher(x2));
50         BOOST_TEST_NE(hasher(x1), hasher(x3));
51 
52         BOOST_TEST_EQ(hasher(x2), hasher(x2));
53         BOOST_TEST_NE(hasher(x2), hasher(x3));
54 
55         BOOST_TEST_EQ(hasher(x3), hasher(x3));
56     }
57 }
58 
main()59 int main()
60 {
61 #ifdef BOOST_HASH_TEST_EXTENSIONS
62     vector_tests::vector_hash_integer_tests();
63 #endif
64 
65     vector_bool_tests::vector_bool_test();
66 
67     return boost::report_errors();
68 }
69