diff options
author | Spartan322 <Megacake1234@gmail.com> | 2024-11-11 09:07:04 -0500 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2024-11-11 09:08:01 -0500 |
commit | 62fbec9f6f0722a1f9825c17f073742932082228 (patch) | |
tree | a10abf56ba93705731da1aaf338f2cf21403c6ad /tests/core/string/test_string.h | |
parent | e7894c2c4efdd51049a21af4892005381fe57cd6 (diff) | |
parent | 0f5f3bc9546b46b2029fc8896dc859697f1eab97 (diff) | |
download | redot-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.h | 19 |
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")); |