@@ -562,4 +562,46 @@ GTEST_TEST(wstring_view, to_lowercase_partial)
562562 hud::wstring_view v (txt);
563563 v.to_lowercase_partial (2 );
564564 hud_assert_true (txt[0 ] == L' a' && txt[1 ] == L' b' && txt[2 ] == L' C' && txt[3 ] == L' 1' && txt[4 ] == L' 2' && txt[5 ] == L' 3' && txt[6 ] == L' ,' && txt[7 ] == L' ;' && txt[8 ] == L' :' && txt[9 ] == L' !' && txt[10 ] == ' \0 ' );
565+ }
566+
567+ GTEST_TEST (wstring_view, slice)
568+ {
569+ hud::wstring_view const_v {L" ABC" };
570+ auto const_s = const_v.as_slice ();
571+ auto const_begin = const_s.begin ();
572+ hud_assert_true (*const_begin == L' A' );
573+ const_begin++;
574+ hud_assert_true (*const_begin == L' B' );
575+ const_begin++;
576+ hud_assert_true (*const_begin == L' C' );
577+ const_begin++;
578+ hud_assert_true (const_begin == const_s.end ());
579+
580+ wchar txt[] = L" ABC" ;
581+ hud::wstring_view v {txt};
582+ auto s = v.as_slice ();
583+ auto begin = s.begin ();
584+ hud_assert_true (*begin == L' A' );
585+ begin++;
586+ hud_assert_true (*begin == L' B' );
587+ begin++;
588+ hud_assert_true (*begin == L' C' );
589+ begin++;
590+ hud_assert_true (begin == s.end ());
591+
592+ auto const_s_1 = v.as_slice ().sub_slice (0 , 2 );
593+ auto const_begin_1 = const_s_1.begin ();
594+ hud_assert_true (*const_begin_1 == L' A' );
595+ const_begin_1++;
596+ hud_assert_true (*const_begin_1 == L' B' );
597+ const_begin_1++;
598+ hud_assert_true (const_begin_1 == const_s_1.end ());
599+
600+ s = v.as_slice ().sub_slice (0 , 2 );
601+ begin = s.begin ();
602+ hud_assert_true (*begin == L' A' );
603+ begin++;
604+ hud_assert_true (*begin == L' B' );
605+ begin++;
606+ hud_assert_true (begin == s.end ());
565607}
0 commit comments