aboutsummaryrefslogtreecommitdiff
path: root/test/common/tokenizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/common/tokenizer.h')
-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());