diff options
Diffstat (limited to 'Swiften/Base/UnitTest/StringTest.cpp')
-rw-r--r-- | Swiften/Base/UnitTest/StringTest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Swiften/Base/UnitTest/StringTest.cpp b/Swiften/Base/UnitTest/StringTest.cpp index 6ad12fd..87e1a99 100644 --- a/Swiften/Base/UnitTest/StringTest.cpp +++ b/Swiften/Base/UnitTest/StringTest.cpp @@ -22,12 +22,15 @@ class StringTest : public CppUnit::TestFixture CPPUNIT_TEST(testReplaceAll); CPPUNIT_TEST(testReplaceAll_LastChar); CPPUNIT_TEST(testReplaceAll_ConsecutiveChars); CPPUNIT_TEST(testReplaceAll_MatchingReplace); CPPUNIT_TEST(testGetLowerCase); CPPUNIT_TEST(testSplit); + CPPUNIT_TEST(testContains); + CPPUNIT_TEST(testContainsFalse); + CPPUNIT_TEST(testContainsExact); CPPUNIT_TEST_SUITE_END(); public: StringTest() {} void testGetLength() { @@ -155,9 +158,22 @@ class StringTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(result.size())); CPPUNIT_ASSERT_EQUAL(String("abc"), result[0]); CPPUNIT_ASSERT_EQUAL(String("def"), result[1]); CPPUNIT_ASSERT_EQUAL(String("ghi"), result[2]); } + + void testContains() { + CPPUNIT_ASSERT(String("abcde").contains(String("bcd"))); + } + + void testContainsFalse() { + CPPUNIT_ASSERT(!String("abcde").contains(String("abcdef"))); + } + + void testContainsExact() { + CPPUNIT_ASSERT(String("abcde").contains(String("abcde"))); + } + }; CPPUNIT_TEST_SUITE_REGISTRATION(StringTest); |