diff --git a/TinySTL/Test/StringTest.cpp b/TinySTL/Test/StringTest.cpp index 73b9acf..4396dd5 100644 --- a/TinySTL/Test/StringTest.cpp +++ b/TinySTL/Test/StringTest.cpp @@ -328,6 +328,25 @@ namespace TinySTL{ assert(TinySTL::Test::container_equal(str, tsStr("There are two prepositions in this haystack with needles."))); } + void testCase20(){ + tsStr str("The sixth sick sheik's sixth sheep's sick."); + tsStr key("sixth"); + + auto found = str.rfind(key); + assert(found == 23); + + found = str.rfind(key, 24); + assert(found == 23); + + found = str.rfind('.'); + assert(found == str.size() - 1); + + found = str.rfind("The"); + assert(found == 0); + + found = str.rfind("sick111", 10, 4); + assert(found == 10); + } } } @@ -352,6 +371,7 @@ int main(){ //testCase17(); //testCase18(); //testCase19(); + testCase20(); system("pause"); return 0; } \ No newline at end of file diff --git a/TinySTL/Test/StringTest.h b/TinySTL/Test/StringTest.h index 3b09e18..b0096ec 100644 --- a/TinySTL/Test/StringTest.h +++ b/TinySTL/Test/StringTest.h @@ -33,6 +33,7 @@ namespace TinySTL{ void testCase17(); void testCase18(); void testCase19(); + void testCase20(); } }