添加测试用例

This commit is contained in:
邹晓航
2014-12-25 10:12:11 +08:00
parent 682f9b3ca4
commit 72f6ed789b
2 changed files with 21 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -33,6 +33,7 @@ namespace TinySTL{
void testCase17();
void testCase18();
void testCase19();
void testCase20();
}
}