提交 72f6ed78 编写于 作者: 邹晓航

添加测试用例

上级 682f9b3c
...@@ -328,6 +328,25 @@ namespace TinySTL{ ...@@ -328,6 +328,25 @@ namespace TinySTL{
assert(TinySTL::Test::container_equal(str, assert(TinySTL::Test::container_equal(str,
tsStr("There are two prepositions in this haystack with needles."))); 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(){ ...@@ -352,6 +371,7 @@ int main(){
//testCase17(); //testCase17();
//testCase18(); //testCase18();
//testCase19(); //testCase19();
testCase20();
system("pause"); system("pause");
return 0; return 0;
} }
\ No newline at end of file
...@@ -33,6 +33,7 @@ namespace TinySTL{ ...@@ -33,6 +33,7 @@ namespace TinySTL{
void testCase17(); void testCase17();
void testCase18(); void testCase18();
void testCase19(); void testCase19();
void testCase20();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册