// Copyright 2017, 2024 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include #include #include #include #include #include template void test_container( R r ) { unsigned char w[] = { 1, 2, 3, 4 }; T v( w, w + sizeof(w) / sizeof(w[0]) ); Flavor f; { Hash h; boost::hash2::hash_append( h, f, v ); BOOST_TEST_EQ( h.result(), r ); } { Hash h; boost::hash2::hash_append_sized_range( h, f, v.begin(), v.end() ); BOOST_TEST_EQ( h.result(), r ); } } template void test( R r ) { test_container< Hash, Flavor, std::vector >( r ); test_container< Hash, Flavor, std::list >( r ); test_container< Hash, Flavor, std::deque >( r ); test_container< Hash, Flavor, std::set >( r ); test_container< Hash, Flavor, std::multiset >( r ); test_container< Hash, Flavor, std::forward_list >( r ); } int main() { using namespace boost::hash2; test( 2468847257 ); test( 78451921 ); test( 2374676325 ); test( 2877134693 ); test( 461647460 ); test( 1394753398 ); return boost::report_errors(); }