// Copyright 2017, 2018 Peter Dimov. // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt // // Endian-dependent test #include #include #include #include #include template void test( R r ) { { S s; for( int i = 0; i < 64; ++i ) { s.insert( i ); } H h; hash_append( h, s ); BOOST_TEST_EQ( h.result(), r ); } { S s; for( int i = 0; i < 64; ++i ) { s.insert( 63 - i ); } H h; hash_append( h, s ); BOOST_TEST_EQ( h.result(), r ); } { S s; for( int i = 0; i < 64; ++i ) { s.insert( ( i * 17 ) % 64 ); } H h; hash_append( h, s ); BOOST_TEST_EQ( h.result(), r ); } } int main() { test< boost::hash2::fnv1a_32, std::set >( 2078558933ul ); test< boost::hash2::fnv1a_64, std::set >( 17046016161958689285ull ); test< boost::hash2::fnv1a_32, std::multiset >( 2078558933ul ); test< boost::hash2::fnv1a_64, std::multiset >( 17046016161958689285ull ); test< boost::hash2::fnv1a_32, std::unordered_set >( 2270492092ul ); test< boost::hash2::fnv1a_64, std::unordered_set >( 3232503781718511241ull ); test< boost::hash2::fnv1a_32, std::unordered_multiset >( 2270492092ul ); test< boost::hash2::fnv1a_64, std::unordered_multiset >( 3232503781718511241ull ); return boost::report_errors(); }