// 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 #if !defined(BOOST_DESCRIBE_CXX14) BOOST_PRAGMA_MESSAGE( "Test skipped, because BOOST_DESCRIBE_CXX14 is not defined" ) int main() {} #elif defined(BOOST_MSVC) && BOOST_MSVC >= 1910 && BOOST_MSVC < 1930 BOOST_PRAGMA_MESSAGE( "Test skipped, because BOOST_MSVC is 191x or 192x" ) int main() {} #else #include #include template struct pair { T1 first; T2 second; BOOST_DESCRIBE_CLASS(pair, (), (first, second), (), ()) }; template void test( pair const& p1, std::pair const& p2, R r ) { Flavor f; { Hash h; hash_append( h, f, p1 ); BOOST_TEST_EQ( h.result(), r ); } { Hash h; hash_append( h, f, p2 ); BOOST_TEST_EQ( h.result(), r ); } } int main() { using namespace boost::hash2; test( {}, {}, 2615243109 ); test( {}, {}, 2615243109 ); test( {}, {}, 2615243109 ); test( { 'A', 3.14 }, { 'A', 3.14 }, 2789734447 ); test( { 'A', 3.14 }, { 'A', 3.14 }, 1423350833 ); return boost::report_errors(); } #endif