From b70bbf14db33881531ab3112e8d0a6741f80a756 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 9 Oct 2021 06:52:08 +0300 Subject: [PATCH] Update sv_find_first_of_test --- test/sv_find_first_of_test.cpp | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/sv_find_first_of_test.cpp b/test/sv_find_first_of_test.cpp index 92e4188..728d4f6 100644 --- a/test/sv_find_first_of_test.cpp +++ b/test/sv_find_first_of_test.cpp @@ -305,6 +305,46 @@ int main() BOOST_TEST_EQ( sv.find_first_of( L"123", 7, 3 ), npos ); } + { + boost::core::wstring_view sv( L"\x101\x102\x103\x101\x102\x103" ); + + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 0, 0 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 1, 0 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 2, 0 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 3, 0 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 4, 0 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 5, 0 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 6, 0 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 7, 0 ), npos ); + + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 0, 1 ), 0 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 1, 1 ), 3 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 2, 1 ), 3 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 3, 1 ), 3 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 4, 1 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 5, 1 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 6, 1 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 7, 1 ), npos ); + + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 0, 2 ), 0 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 1, 2 ), 1 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 2, 2 ), 3 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 3, 2 ), 3 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 4, 2 ), 4 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 5, 2 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 6, 2 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 7, 2 ), npos ); + + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 0, 3 ), 0 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 1, 3 ), 1 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 2, 3 ), 2 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 3, 3 ), 3 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 4, 3 ), 4 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 5, 3 ), 5 ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 6, 3 ), npos ); + BOOST_TEST_EQ( sv.find_first_of( L"\x101\x102\x103", 7, 3 ), npos ); + } + { boost::core::string_view sv( "abc1abc2abc3" );