// Copyright 2017, 2018, 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( R const& r ) { using boost::hash2::get_integral_result; { auto t1 = get_integral_result( r ); auto t2 = get_integral_result( r ); BOOST_TEST_EQ( static_cast( t1 ), t2 ); } { auto t1 = get_integral_result( r ); auto t2 = get_integral_result( r ); BOOST_TEST_EQ( static_cast( t1 ), t2 ); } { auto t1 = get_integral_result( r ); auto t2 = get_integral_result( r ); BOOST_TEST_EQ( static_cast( t1 ), t2 ); } { auto t1 = get_integral_result( r ); auto t2 = get_integral_result( r ); BOOST_TEST_EQ( static_cast( t1 ), t2 ); } { auto t1 = get_integral_result( r ); auto t2 = get_integral_result( r ); BOOST_TEST_EQ( static_cast( t1 ), t2 ); } } int main() { using boost::hash2::get_integral_result; test( 0x1E ); test( 0xE1 ); test( 0x1E1E ); test( 0xE1E1 ); test( 0x1E1E1E1Eu ); test( 0xE1E1E1E1u ); test( 0x1E1E1E1E1E1E1E1Eull ); test( 0xE1E1E1E1E1E1E1E1ull ); test< std::array >( {{ 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E }} ); test< std::array >( {{ 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1 }} ); test< boost::array >( {{ 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E }} ); test< boost::array >( {{ 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1 }} ); test< boost::hash2::digest<8> >( {{ 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E }} ); test< boost::hash2::digest<8> >( {{ 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1, 0xE1 }} ); return boost::report_errors(); }