// Copyright 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 template void test( T const* first, T const* last, R r ) { Hash h; Flavor f; boost::hash2::hash_append_range( h, f, first, last ); BOOST_TEST_EQ( h.result(), r ); } struct X { }; BOOST_DESCRIBE_STRUCT(X, (), ()) // A hash_append call must always result in a call to Hash::update int main() { using namespace boost::hash2; { boost::array v[ 3 ]; test( v + 0, v + 1, 84696351 ); test( v + 0, v + 2, 292984781 ); test( v + 0, v + 3, 1253111735 ); } { std::array v[ 3 ]; test( v + 0, v + 1, 84696351 ); test( v + 0, v + 2, 292984781 ); test( v + 0, v + 3, 1253111735 ); } #if defined(BOOST_DESCRIBE_CXX14) { X v[ 3 ]; test( v + 0, v + 1, 84696351 ); test( v + 0, v + 2, 292984781 ); test( v + 0, v + 3, 1253111735 ); } #endif return boost::report_errors(); }