diff --git a/TinySTL/Test/StringTest.cpp b/TinySTL/Test/StringTest.cpp index 54316e0..7ee7267 100644 --- a/TinySTL/Test/StringTest.cpp +++ b/TinySTL/Test/StringTest.cpp @@ -222,6 +222,30 @@ namespace TinySTL{ s2 += tsStr("world"); assert(TinySTL::Test::container_equal(s1, s2)); } + void testCase14(){ + stdStr s1("hello world"); + tsStr s2("hello world"); + + s1.pop_back(); + s2.pop_back(); + assert(TinySTL::Test::container_equal(s1, s2)); + } + void testCase15(){ + stdStr s1("hello world"); + tsStr s2("hello world"); + + s1.erase(s1.begin() + 1); + s2.erase(s2.begin() + 1); + assert(TinySTL::Test::container_equal(s1, s2)); + + s1.erase(2, s1.size() - 4); + s2.erase(2, s2.size() - 4); + assert(TinySTL::Test::container_equal(s1, s2)); + + s1.erase(s1.begin(), s1.end()); + s2.erase(s2.begin(), s2.end()); + assert(TinySTL::Test::container_equal(s1, s2)); + } } } @@ -240,6 +264,8 @@ int main(){ //testCase11(); testCase12(); testCase13(); + testCase14(); + testCase15(); system("pause"); return 0; } \ No newline at end of file diff --git a/TinySTL/Test/StringTest.h b/TinySTL/Test/StringTest.h index 56a3c41..e778a6c 100644 --- a/TinySTL/Test/StringTest.h +++ b/TinySTL/Test/StringTest.h @@ -27,6 +27,8 @@ namespace TinySTL{ void testCase11(); void testCase12(); void testCase13(); + void testCase14(); + void testCase15(); } }