From bf65404f356e8c0d3f02b91ae3cb2464c531c103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Thu, 25 Dec 2014 10:54:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Test/StringTest.cpp | 14 ++++++++++++++ TinySTL/Test/StringTest.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/TinySTL/Test/StringTest.cpp b/TinySTL/Test/StringTest.cpp index 9ad547d..1fa0572 100644 --- a/TinySTL/Test/StringTest.cpp +++ b/TinySTL/Test/StringTest.cpp @@ -382,6 +382,18 @@ namespace TinySTL{ found = str.find_last_of(tsStr("#1"), 19); assert(found == 19); } + void testCase23(){ + tsStr str("look for non-alphabetic characters..."); + + auto found = str.find_first_not_of("abcdefghijklmnopqrstuvwxyz "); + assert(found == 12); + } + void testCase24(){ + tsStr str("12345678900987654321"); + + auto found = str.find_last_not_of("023456789", str.size() - 2); + assert(found == 0); + } } } @@ -409,6 +421,8 @@ int main(){ testCase20(); testCase21(); testCase22(); + testCase23(); + testCase24(); system("pause"); return 0; } \ No newline at end of file diff --git a/TinySTL/Test/StringTest.h b/TinySTL/Test/StringTest.h index 6587378..4c332ec 100644 --- a/TinySTL/Test/StringTest.h +++ b/TinySTL/Test/StringTest.h @@ -36,6 +36,8 @@ namespace TinySTL{ void testCase20(); void testCase21(); void testCase22(); + void testCase23(); + void testCase24(); } }