diff options
author | Max Horn | 2005-02-06 19:01:23 +0000 |
---|---|---|
committer | Max Horn | 2005-02-06 19:01:23 +0000 |
commit | 490bba8ecb318f8fd252296b79eee853615cda2f (patch) | |
tree | 61f911a359ab85c0a5bcb5e15120875b7517e2ce /test/common | |
parent | 4e66139a4e3d33fce662ad572fca26f49a5d9de4 (diff) | |
download | scummvm-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')
-rw-r--r-- | test/common/str.h | 18 |
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"); |