summaryrefslogtreecommitdiff
path: root/Source/UnitTests/Common/StringUtilTest.cpp
diff options
context:
space:
mode:
authorMat M <mathew1800@gmail.com>2016-12-19 15:45:21 -0500
committerGitHub <noreply@github.com>2016-12-19 15:45:21 -0500
commit4e405010a3601b0cad032da1fec6308732a8c52a (patch)
tree1ab36752bd97531088efeb723a78cfdd3dc7debe /Source/UnitTests/Common/StringUtilTest.cpp
parentb9dc73d9cdaa4f660ab5293ed0322d0849020dc4 (diff)
parenta6114bad34f85eae346d2c7eec8d2f35c1728cf9 (diff)
Merge pull request #4497 from sepalani/totaldb.csv
Import/Export signature files as CSV
Diffstat (limited to 'Source/UnitTests/Common/StringUtilTest.cpp')
-rw-r--r--Source/UnitTests/Common/StringUtilTest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/UnitTests/Common/StringUtilTest.cpp b/Source/UnitTests/Common/StringUtilTest.cpp
index 603c99d80c..0a45c3b26a 100644
--- a/Source/UnitTests/Common/StringUtilTest.cpp
+++ b/Source/UnitTests/Common/StringUtilTest.cpp
@@ -16,3 +16,27 @@ TEST(StringUtil, JoinStrings)
EXPECT_EQ("a, bb, c", JoinStrings({"a", "bb", "c"}, ", "));
EXPECT_EQ("???", JoinStrings({"?", "?"}, "?"));
}
+
+TEST(StringUtil, StringBeginsWith)
+{
+ EXPECT_EQ(true, StringBeginsWith("abc", "a"));
+ EXPECT_EQ(false, StringBeginsWith("abc", "b"));
+ EXPECT_EQ(true, StringBeginsWith("abc", "ab"));
+ EXPECT_EQ(false, StringBeginsWith("a", "ab"));
+ EXPECT_EQ(false, StringBeginsWith("", "a"));
+ EXPECT_EQ(false, StringBeginsWith("", "ab"));
+ EXPECT_EQ(true, StringBeginsWith("abc", ""));
+ EXPECT_EQ(true, StringBeginsWith("", ""));
+}
+
+TEST(StringUtil, StringEndsWith)
+{
+ EXPECT_EQ(true, StringEndsWith("abc", "c"));
+ EXPECT_EQ(false, StringEndsWith("abc", "b"));
+ EXPECT_EQ(true, StringEndsWith("abc", "bc"));
+ EXPECT_EQ(false, StringEndsWith("a", "ab"));
+ EXPECT_EQ(false, StringEndsWith("", "a"));
+ EXPECT_EQ(false, StringEndsWith("", "ab"));
+ EXPECT_EQ(true, StringEndsWith("abc", ""));
+ EXPECT_EQ(true, StringEndsWith("", ""));
+}