summaryrefslogtreecommitdiff
path: root/Tests/AK/TestString.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/AK/TestString.cpp')
-rw-r--r--Tests/AK/TestString.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Tests/AK/TestString.cpp b/Tests/AK/TestString.cpp
index b61828199e..40953ec418 100644
--- a/Tests/AK/TestString.cpp
+++ b/Tests/AK/TestString.cpp
@@ -168,6 +168,26 @@ TEST_CASE(replace)
EXPECT(test_string == "111._.|||._.|||");
}
+TEST_CASE(count)
+{
+ String test_string = "Well, hello Friends!";
+ u32 count = test_string.count("Friends");
+ EXPECT(count == 1);
+
+ count = test_string.count("ell");
+ EXPECT(count == 2);
+
+ count = test_string.count("!");
+ EXPECT(count == 1);
+
+ test_string = String("111._.111._.111");
+ count = test_string.count("111");
+ EXPECT(count == 3);
+
+ count = test_string.count("._.");
+ EXPECT(count == 2);
+}
+
TEST_CASE(substring)
{
String test = "abcdef";