aboutsummaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
authorMax Horn2010-04-10 23:13:18 +0000
committerMax Horn2010-04-10 23:13:18 +0000
commit726500a2f3048b274364ba6f82203c0712bd8248 (patch)
treeea4abc9133cc77f22dfa4b57a8b3af8b6c6a3999 /test/common
parentfcee4f2ad753c06b4c58fc21c69b0d4e7f0c4967 (diff)
downloadscummvm-rg350-726500a2f3048b274364ba6f82203c0712bd8248.tar.gz
scummvm-rg350-726500a2f3048b274364ba6f82203c0712bd8248.tar.bz2
scummvm-rg350-726500a2f3048b274364ba6f82203c0712bd8248.zip
Slightly tweak Common::StringTokenizer tests, cleanup
svn-id: r48614
Diffstat (limited to 'test/common')
-rw-r--r--test/common/tokenizer.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/test/common/tokenizer.h b/test/common/tokenizer.h
index 3f4b042c00..3420b562aa 100644
--- a/test/common/tokenizer.h
+++ b/test/common/tokenizer.h
@@ -6,33 +6,32 @@ class TokenizerTestSuite : public CxxTest::TestSuite {
public:
void test_nextToken() {
- // test Common::StringTokenizer class
-
// test normal behavior
Common::StringTokenizer strTokenizer("Now, this is a test!", " ,!");
Common::String tokenArray[] = {"Now", "this", "is", "a", "test"};
- for (int i = 0; i < ARRAYSIZE(tokenArray); i++ ) {
+ for (int i = 0; i < ARRAYSIZE(tokenArray); ++i) {
// make sure nextToken works correctly
TS_ASSERT_EQUALS(tokenArray[i], strTokenizer.nextToken());
}
+ TS_ASSERT(strTokenizer.empty());
- // test edgy conditions:
+ // Test edge cases:
- // Empty String
+ // empty string
Common::StringTokenizer s1("");
TS_ASSERT_EQUALS("", s1.nextToken());
-
- // Empty Delimiter
+ TS_ASSERT(s1.empty());
+
+ // empty delimiter
Common::StringTokenizer s2("test String", "");
TS_ASSERT_EQUALS("test String", s2.nextToken());
-
- // String is the delimiter
+
+ // string is the delimiter
Common::StringTokenizer s3("abc", "abc");
TS_ASSERT_EQUALS("", s3.nextToken());
- // Tokenizer should be empty
TS_ASSERT(s3.empty());
-
+
// consecutive delimiters in the string
Common::StringTokenizer s4("strstr,after all!!", "str, !");
TS_ASSERT_EQUALS("af", s4.nextToken());
@@ -43,10 +42,10 @@ public:
// test reset()
Common::String token1 = strTokenizer.nextToken(); //Just
+ TS_ASSERT_EQUALS(token1, "Just");
strTokenizer.reset();
Common::String token2 = strTokenizer.nextToken(); //Just
-
- TS_ASSERT_EQUALS(token1,token2);
+ TS_ASSERT_EQUALS(token2, "Just");
// test empty()
TS_ASSERT(!strTokenizer.empty());