From e39bf42dfcb423345a8919a777637d07e67fd7ca Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 15 Jun 2022 22:56:57 +0300 Subject: [PATCH] Update hash_string_test2.cpp --- test/hash_string_test2.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/test/hash_string_test2.cpp b/test/hash_string_test2.cpp index 4dc67d9..f37b423 100644 --- a/test/hash_string_test2.cpp +++ b/test/hash_string_test2.cpp @@ -11,6 +11,12 @@ #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) #include #endif +#include +#include +#include +#if !defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) +# include +#endif // Test whether the hash values of a string and a // string_view that refers to it match. This is @@ -24,12 +30,21 @@ template std::size_t hv( T const& t ) int main() { std::string s( "Test." ); + std::size_t h0 = hv( s ); - BOOST_TEST_EQ( hv( s ), hv( boost::string_view( s ) ) ); - BOOST_TEST_EQ( hv( s ), hv( boost::core::string_view( s ) ) ); + BOOST_TEST_EQ( h0, hv( boost::string_view( s ) ) ); + BOOST_TEST_EQ( h0, hv( boost::core::string_view( s ) ) ); #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) - BOOST_TEST_EQ( hv( s ), hv( std::string_view( s ) ) ); + BOOST_TEST_EQ( h0, hv( std::string_view( s ) ) ); +#endif + + BOOST_TEST_EQ( h0, hv( std::vector( s.begin(), s.end() ) ) ); + BOOST_TEST_EQ( h0, hv( std::deque( s.begin(), s.end() ) ) ); + BOOST_TEST_EQ( h0, hv( std::list( s.begin(), s.end() ) ) ); + +#if !defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) + BOOST_TEST_EQ( h0, hv( std::forward_list( s.begin(), s.end() ) ) ); #endif return boost::report_errors();