diff --git a/test/sv_find_first_not_of_test.cpp b/test/sv_find_first_not_of_test.cpp index 2998e03..a32a6e1 100644 --- a/test/sv_find_first_not_of_test.cpp +++ b/test/sv_find_first_not_of_test.cpp @@ -524,6 +524,41 @@ int main() } } + { + wchar_t str[ 256 ]; + + for( int i = 0; i < 256; ++i ) + { + str[ i ] = static_cast< wchar_t >( 0x100 + i ); + } + + boost::core::wstring_view sv( str, 256 ); + + BOOST_TEST_EQ( sv.find_first_not_of( sv ), npos ); + + std::wstring str2( sv.data(), sv.size() ); + + for( int i = 0; i < 256; ++i ) + { + std::wstring str3( str2 ); + + str3[ i ] = ~str3[ i ]; + + BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i ); + } + + std::reverse( str, str + 256 ); + + for( int i = 0; i < 256; ++i ) + { + std::wstring str3( str2 ); + + str3[ i ] = ~str3[ i ]; + + BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i ); + } + } + #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L { diff --git a/test/sv_find_first_of_test.cpp b/test/sv_find_first_of_test.cpp index 728d4f6..f5704c0 100644 --- a/test/sv_find_first_of_test.cpp +++ b/test/sv_find_first_of_test.cpp @@ -446,6 +446,31 @@ int main() } } + { + wchar_t str[ 256 ]; + + for( int i = 0; i < 256; ++i ) + { + str[ i ] = static_cast< wchar_t >( 0x100 + i ); + } + + boost::core::wstring_view sv( str, 256 ); + + for( int i = 0; i < 256; ++i ) + { + std::wstring needle( 12, static_cast< wchar_t >( 0x100 + i ) ); + BOOST_TEST_EQ( sv.find_first_of( needle ), i ); + } + + std::reverse( str, str + 256 ); + + for( int i = 0; i < 256; ++i ) + { + std::wstring needle( 12, static_cast< wchar_t >( 0x100 + i ) ); + BOOST_TEST_EQ( sv.find_first_of( needle ), 255 - i ); + } + } + #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L { diff --git a/test/sv_find_last_not_of_test.cpp b/test/sv_find_last_not_of_test.cpp index 348eb29..96a71cd 100644 --- a/test/sv_find_last_not_of_test.cpp +++ b/test/sv_find_last_not_of_test.cpp @@ -524,6 +524,41 @@ int main() } } + { + wchar_t str[ 256 ]; + + for( int i = 0; i < 256; ++i ) + { + str[ i ] = static_cast< wchar_t >( 0x100 + i ); + } + + boost::core::wstring_view sv( str, 256 ); + + BOOST_TEST_EQ( sv.find_first_not_of( sv ), npos ); + + std::wstring str2( sv.data(), sv.size() ); + + for( int i = 0; i < 256; ++i ) + { + std::wstring str3( str2 ); + + str3[ i ] = ~str3[ i ]; + + BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i ); + } + + std::reverse( str, str + 256 ); + + for( int i = 0; i < 256; ++i ) + { + std::wstring str3( str2 ); + + str3[ i ] = ~str3[ i ]; + + BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i ); + } + } + #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L { diff --git a/test/sv_find_last_of_test.cpp b/test/sv_find_last_of_test.cpp index 2008ab9..5cc0624 100644 --- a/test/sv_find_last_of_test.cpp +++ b/test/sv_find_last_of_test.cpp @@ -464,6 +464,31 @@ int main() } } + { + wchar_t str[ 256 ]; + + for( int i = 0; i < 256; ++i ) + { + str[ i ] = static_cast< wchar_t >( 0x100 + i ); + } + + boost::core::wstring_view sv( str, 256 ); + + for( int i = 0; i < 256; ++i ) + { + std::wstring needle( 12, static_cast< wchar_t >( 0x100 + i ) ); + BOOST_TEST_EQ( sv.find_first_of( needle ), i ); + } + + std::reverse( str, str + 256 ); + + for( int i = 0; i < 256; ++i ) + { + std::wstring needle( 12, static_cast< wchar_t >( 0x100 + i ) ); + BOOST_TEST_EQ( sv.find_first_of( needle ), 255 - i ); + } + } + #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L {