summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2006-02-21 12:27:17 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2006-02-21 12:27:17 +0000
commit5a8710676d58be3b3f3606993e802c6a075dbd89 (patch)
tree634e1f7be2dffb00c4248323c1465f22aedb6f60 /test
parent6d6f25b75c1557f2b92e51fe589aadc48a1fdb68 (diff)
Diffstat (limited to 'test')
-rw-r--r--test/UtilTest.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/UtilTest.cc b/test/UtilTest.cc
index 5dbc6148..0100adbb 100644
--- a/test/UtilTest.cc
+++ b/test/UtilTest.cc
@@ -10,6 +10,7 @@ class UtilTest:public CppUnit::TestFixture {
CPPUNIT_TEST(testTrim);
CPPUNIT_TEST(testSplit);
CPPUNIT_TEST(testSlice);
+ CPPUNIT_TEST(testEndsWith);
CPPUNIT_TEST_SUITE_END();
private:
@@ -20,6 +21,7 @@ public:
void testTrim();
void testSplit();
void testSlice();
+ void testEndsWith();
};
@@ -75,3 +77,37 @@ void UtilTest::testSlice() {
CPPUNIT_ASSERT_EQUAL(string("name2=value2"), *itr++);
CPPUNIT_ASSERT_EQUAL(string("name3=value3"), *itr++);
}
+
+void UtilTest::testEndsWith() {
+ string target = "abcdefg";
+ string part = "fg";
+ CPPUNIT_ASSERT(Util::endsWith(target, part));
+
+ target = "abdefg";
+ part = "g";
+ CPPUNIT_ASSERT(Util::endsWith(target, part));
+
+ target = "abdefg";
+ part = "eg";
+ CPPUNIT_ASSERT(!Util::endsWith(target, part));
+
+ target = "g";
+ part = "eg";
+ CPPUNIT_ASSERT(!Util::endsWith(target, part));
+
+ target = "g";
+ part = "g";
+ CPPUNIT_ASSERT(Util::endsWith(target, part));
+
+ target = "g";
+ part = "";
+ CPPUNIT_ASSERT(Util::endsWith(target, part));
+
+ target = "";
+ part = "";
+ CPPUNIT_ASSERT(Util::endsWith(target, part));
+
+ target = "";
+ part = "g";
+ CPPUNIT_ASSERT(!Util::endsWith(target, part));
+}