aboutsummaryrefslogtreecommitdiff
path: root/test/common/str.h
diff options
context:
space:
mode:
authorMax Horn2005-02-06 19:01:23 +0000
committerMax Horn2005-02-06 19:01:23 +0000
commit490bba8ecb318f8fd252296b79eee853615cda2f (patch)
tree61f911a359ab85c0a5bcb5e15120875b7517e2ce /test/common/str.h
parent4e66139a4e3d33fce662ad572fca26f49a5d9de4 (diff)
downloadscummvm-rg350-490bba8ecb318f8fd252296b79eee853615cda2f.tar.gz
scummvm-rg350-490bba8ecb318f8fd252296b79eee853615cda2f.tar.bz2
scummvm-rg350-490bba8ecb318f8fd252296b79eee853615cda2f.zip
Add testcases for String::hasSuffix and hasPrefix
svn-id: r16745
Diffstat (limited to 'test/common/str.h')
-rw-r--r--test/common/str.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h
index 7b71bd3ecd..e392c5aba8 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -47,6 +47,24 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( str, "fooX" );
}
+ void test_hasPrefix( void )
+ {
+ Common::String str("this/is/a/test, haha");
+ TS_ASSERT_EQUALS( str.hasPrefix(""), true );
+ TS_ASSERT_EQUALS( str.hasPrefix("this"), true );
+ TS_ASSERT_EQUALS( str.hasPrefix("thit"), false );
+ TS_ASSERT_EQUALS( str.hasPrefix("foo"), false );
+ }
+
+ void test_hasSuffix( void )
+ {
+ Common::String str("this/is/a/test, haha");
+ TS_ASSERT_EQUALS( str.hasSuffix(""), true );
+ TS_ASSERT_EQUALS( str.hasSuffix("haha"), true );
+ TS_ASSERT_EQUALS( str.hasSuffix("hahb"), false );
+ TS_ASSERT_EQUALS( str.hasSuffix("hahah"), false );
+ }
+
void test_toLowercase( void )
{
Common::String str("Test it, NOW! 42");