diff options
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/str.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h index 3c69d1792c..c6a6e7bed6 100644 --- a/test/common/str.h +++ b/test/common/str.h @@ -40,6 +40,15 @@ class StringTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(str2.lastChar(), 'r'); } + void test_firstChar() { + Common::String str; + TS_ASSERT_EQUALS(str.firstChar(), '\0'); + str = "first_test"; + TS_ASSERT_EQUALS(str.firstChar(), 'f'); + Common::String str2("bar"); + TS_ASSERT_EQUALS(str2.firstChar(), 'b'); + } + void test_concat1() { Common::String str("foo"); Common::String str2("bar"); @@ -542,4 +551,20 @@ class StringTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(s3, "TestTestTest"); TS_ASSERT_EQUALS(s4, "TestTestTestTestTestTestTestTestTestTestTest"); } + + void test_setChar() { + Common::String testString("123456"); + testString.setChar('2', 0); + TS_ASSERT(testString == "223456"); + testString.setChar('0', 5); + TS_ASSERT(testString == "223450"); + } + + void test_insertChar() { + Common::String testString("123456"); + testString.insertChar('2', 0); + TS_ASSERT(testString == "2123456"); + testString.insertChar('0', 5); + TS_ASSERT(testString == "21234056"); + } }; |