// 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 #include template void test() { using boost::hash2::get_integral_result; Hash h; get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); get_integral_result( h ); } template struct H1: private boost::hash2::fnv1a_64 { using result_type = R; result_type result() { return static_cast( boost::hash2::fnv1a_64::result() ); } }; template struct H2: private boost::hash2::md5_128 { using result_type = R; result_type result() { boost::hash2::md5_128::result_type r1 = boost::hash2::md5_128::result(); R r2 = {{}}; std::memcpy( &r2[0], &r1[0], std::min( r1.size(), r2.size() ) ); return r2; } }; template void test2() { test< H1 >(); } template void test3() { test< H2 >(); } int main() { using boost::hash2::get_integral_result; test2< unsigned char >(); test2< unsigned short >(); test2< unsigned int >(); test2< unsigned long >(); test2< unsigned long long >(); test3< std::array >(); test3< std::array >(); test3< std::array >(); test3< std::array >(); test3< std::array >(); test3< std::array >(); test3< std::array >(); test3< boost::array >(); test3< boost::array >(); test3< boost::array >(); test3< boost::array >(); test3< boost::array >(); test3< boost::array >(); test3< boost::array >(); test3< boost::hash2::digest<8> >(); test3< boost::hash2::digest<16> >(); test3< boost::hash2::digest<20> >(); test3< boost::hash2::digest<28> >(); test3< boost::hash2::digest<32> >(); test3< boost::hash2::digest<48> >(); test3< boost::hash2::digest<64> >(); }