summaryrefslogtreecommitdiffstats
path: root/tests/core/string/test_string.h
diff options
context:
space:
mode:
authorSpartan322 <Megacake1234@gmail.com>2024-11-11 09:07:04 -0500
committerSpartan322 <Megacake1234@gmail.com>2024-11-11 09:08:01 -0500
commit62fbec9f6f0722a1f9825c17f073742932082228 (patch)
treea10abf56ba93705731da1aaf338f2cf21403c6ad /tests/core/string/test_string.h
parente7894c2c4efdd51049a21af4892005381fe57cd6 (diff)
parent0f5f3bc9546b46b2029fc8896dc859697f1eab97 (diff)
downloadredot-engine-62fbec9f6f0722a1f9825c17f073742932082228.tar.gz
Merge commit godotengine/godot@0f5f3bc9546b46b2029fc8896dc859697f1eab97
Diffstat (limited to 'tests/core/string/test_string.h')
-rw-r--r--tests/core/string/test_string.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h
index d7dc7c99b9..fd9b43a677 100644
--- a/tests/core/string/test_string.h
+++ b/tests/core/string/test_string.h
@@ -391,6 +391,19 @@ TEST_CASE("[String] Find") {
MULTICHECK_STRING_INT_EQ(s, rfind, "", 15, -1);
}
+TEST_CASE("[String] Find character") {
+ String s = "racecar";
+ CHECK_EQ(s.find_char('r'), 0);
+ CHECK_EQ(s.find_char('r', 1), 6);
+ CHECK_EQ(s.find_char('e'), 3);
+ CHECK_EQ(s.find_char('e', 4), -1);
+
+ CHECK_EQ(s.rfind_char('r'), 6);
+ CHECK_EQ(s.rfind_char('r', 5), 0);
+ CHECK_EQ(s.rfind_char('e'), 3);
+ CHECK_EQ(s.rfind_char('e', 2), -1);
+}
+
TEST_CASE("[String] Find case insensitive") {
String s = "Pretty Whale Whale";
MULTICHECK_STRING_EQ(s, findn, "WHA", 7);
@@ -1256,6 +1269,12 @@ TEST_CASE("[String] is_subsequence_of") {
CHECK(String("Sub").is_subsequence_ofn(a));
}
+TEST_CASE("[String] is_lowercase") {
+ CHECK(String("abcd1234 !@#$%^&*()_-=+,.<>/\\|[]{};':\"`~").is_lowercase());
+ CHECK(String("").is_lowercase());
+ CHECK(!String("abc_ABC").is_lowercase());
+}
+
TEST_CASE("[String] match") {
CHECK(String("img1.png").match("*.png"));
CHECK(!String("img1.jpeg").match("*.png"));