aboutsummaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
authorStephen Kennedy2008-07-22 00:15:13 +0000
committerStephen Kennedy2008-07-22 00:15:13 +0000
commit0861fa4c00f0ecb82f3607127c8278d55f95376c (patch)
treed757c116b163a401f00859503a7db755b6627504 /test/common
parenta58080bd58bbcc9f7c710fade55620049bae14e4 (diff)
parente09eb75ef77d6e76b763b3a47540a530013a887f (diff)
downloadscummvm-rg350-0861fa4c00f0ecb82f3607127c8278d55f95376c.tar.gz
scummvm-rg350-0861fa4c00f0ecb82f3607127c8278d55f95376c.tar.bz2
scummvm-rg350-0861fa4c00f0ecb82f3607127c8278d55f95376c.zip
Merged revisions 32879,32883,32895,32899,32902-32904,32910-32912,32923-32924,32930-32931,32938,32940,32948-32949,32951,32960-32964,32966-32970,32972-32974,32976,32978,32983,32986-32990,32992,32994,33002-33004,33006-33007,33009-33010,33014,33017,33021-33023,33030,33033,33052-33053,33056-33058,33061-33064,33068,33070,33072,33075,33078-33079,33083,33086-33087,33089,33094-33096,33098-33099,33104,33108-33109,33114-33117,33120,33135-33146,33160,33162,33165,33167-33169 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk svn-id: r33185
Diffstat (limited to 'test/common')
-rw-r--r--test/common/str.h53
1 files changed, 25 insertions, 28 deletions
diff --git a/test/common/str.h b/test/common/str.h
index dcba554b5a..76574ea70f 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -5,16 +5,25 @@
class StringTestSuite : public CxxTest::TestSuite
{
public:
- void test_empty_clear( void )
- {
+ void test_constructors(void) {
+ Common::String str("test-string");
+ TS_ASSERT( str == "test-string" );
+ str = Common::String(str.c_str()+5, 3);
+ TS_ASSERT( str == "str" );
+ str = "test-string";
+ TS_ASSERT( str == "test-string" );
+ str = Common::String(str.c_str()+5, str.c_str()+8);
+ TS_ASSERT( str == "str" );
+ }
+
+ void test_empty_clear(void) {
Common::String str("test");
TS_ASSERT( !str.empty() );
str.clear();
TS_ASSERT( str.empty() );
}
- void test_lastChar( void )
- {
+ void test_lastChar(void) {
Common::String str;
TS_ASSERT_EQUALS( str.lastChar(), '\0' );
str = "test";
@@ -23,8 +32,7 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( str2.lastChar(), 'r' );
}
- void test_concat1( void )
- {
+ void test_concat1(void) {
Common::String str("foo");
Common::String str2("bar");
str += str2;
@@ -32,22 +40,19 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( str2, "bar" );
}
- void test_concat2( void )
- {
+ void test_concat2(void) {
Common::String str("foo");
str += "bar";
TS_ASSERT_EQUALS( str, "foobar" );
}
- void test_concat3( void )
- {
+ void test_concat3(void) {
Common::String str("foo");
str += 'X';
TS_ASSERT_EQUALS( str, "fooX" );
}
- void test_refCount( void )
- {
+ void test_refCount(void) {
Common::String foo1("foo");
Common::String foo2("foo");
Common::String foo3(foo2);
@@ -57,8 +62,7 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( foo3, "foo""X" );
}
- void test_refCount2( void )
- {
+ void test_refCount2(void) {
Common::String foo1("fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd");
Common::String foo2("fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd");
Common::String foo3(foo2);
@@ -68,8 +72,7 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( foo3, "fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd""X" );
}
- void test_refCount3( void )
- {
+ void test_refCount3(void) {
Common::String foo1("0123456789abcdefghijk");
Common::String foo2("0123456789abcdefghijk");
Common::String foo3(foo2);
@@ -79,8 +82,7 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( foo3, "0123456789abcdefghijk""0123456789abcdefghijk" );
}
- void test_refCount4( void )
- {
+ void test_refCount4(void) {
Common::String foo1("fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd");
Common::String foo2("fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd");
Common::String foo3(foo2);
@@ -90,8 +92,7 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( foo3, "fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd""fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd" );
}
- void test_hasPrefix( void )
- {
+ 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 );
@@ -99,8 +100,7 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( str.hasPrefix("foo"), false );
}
- void test_hasSuffix( void )
- {
+ 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 );
@@ -108,8 +108,7 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( str.hasSuffix("hahah"), false );
}
- void test_contains( void )
- {
+ void test_contains(void) {
Common::String str("this/is/a/test, haha");
TS_ASSERT_EQUALS( str.contains(""), true );
TS_ASSERT_EQUALS( str.contains("haha"), true );
@@ -117,15 +116,13 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS( str.contains("test"), true );
}
- void test_toLowercase( void )
- {
+ void test_toLowercase(void) {
Common::String str("Test it, NOW! 42");
str.toLowercase();
TS_ASSERT_EQUALS( str, "test it, now! 42" );
}
- void test_toUppercase( void )
- {
+ void test_toUppercase(void) {
Common::String str("Test it, NOW! 42");
str.toUppercase();
TS_ASSERT_EQUALS( str, "TEST IT, NOW! 42" );