3 // Copyright Neil Groves 2014. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/range/
11 #include <boost/range/iterator_range_hash.hpp>
13 #include <boost/test/test_tools.hpp>
14 #include <boost/test/unit_test.hpp>
18 namespace boost_range_test
23 void test_iterator_range_hash()
25 std::vector<boost::int32_t> v;
27 for (boost::int32_t i = 0; i < 10; ++i)
32 std::size_t ref_output = boost::hash_range(v.begin(), v.end());
34 boost::iterator_range<std::vector<boost::int32_t>::iterator> rng(v);
36 std::size_t test_output = boost::hash_value(rng);
38 BOOST_CHECK_EQUAL(ref_output, test_output);
41 } // anonymous namespace
42 } // namespace boost_range_test
44 boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
46 boost::unit_test::test_suite* test =
47 BOOST_TEST_SUITE("Boost.Range iterator_range hash function");
49 test->add(BOOST_TEST_CASE(&boost_range_test::test_iterator_range_hash));