Skip to content

Commit f782ba4

Browse files
committed
Add tests
1 parent f6764f4 commit f782ba4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: test/src/String/test_replace.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,24 @@ TEST_CASE ("Testing String::replace(String, String) substr 'find' smaller than '
6666
str.replace(arduino::String("ll"), arduino::String("111"));
6767
REQUIRE(str == "He111o Arduino!");
6868
}
69+
70+
TEST_CASE ("Testing String::replace(String, String) substr 'find' smaller than 'replace' multiple occurencies", "[String-replace-08]")
71+
{
72+
arduino::String str("Hello Arduino! Hello, Hello, Hello");
73+
str.replace(arduino::String("ll"), arduino::String("lll"));
74+
REQUIRE(str == "Helllo Arduino! Helllo, Helllo, Helllo");
75+
}
76+
77+
TEST_CASE ("Testing String::replace(String, String) substr 'find' same length as 'replace' multiple occurencies", "[String-replace-09]")
78+
{
79+
arduino::String str("Hello Arduino! Hello, Hello, Hello");
80+
str.replace(arduino::String("ll"), arduino::String("11"));
81+
REQUIRE(str == "He11o Arduino! He11o, He11o, He11o");
82+
}
83+
84+
TEST_CASE ("Testing String::replace(String, String) substr 'find' larger than 'replace' multiple occurencies", "[String-replace-10]")
85+
{
86+
arduino::String str("Helllo Arduino! Helllo, Helllo, Helllo");
87+
str.replace(arduino::String("lll"), arduino::String("ll"));
88+
REQUIRE(str == "Hello Arduino! Hello, Hello, Hello");
89+
}

0 commit comments

Comments
 (0)