Skip to content

Commit b2ef348

Browse files
committed
NOT WORKING - Add test case for & String::operator = (const String &) with invalid buffer of first string
1 parent 0eaaf5e commit b2ef348

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

+12-2
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,11 @@ TEST_CASE ("Testing & String::operator = (StringSumHelper &&rval)", "[String-ope
114114
*/
115115
}
116116

117-
TEST_CASE ("Testing & String::operator = (const String &)", "[String-operator+-13]")
117+
TEST_CASE ("Testing & String::operator = (const String &) with invalid buffer of second string", "[String-operator+-13]")
118118
{
119119
arduino::String str1("Hello");
120120

121121
char *buffer2 = NULL;
122-
123122
arduino::String str2(buffer2);
124123

125124
str1 = str2;
@@ -132,4 +131,15 @@ TEST_CASE ("Testing & String::operator = (const char *)", "[String-operator+-14]
132131
arduino::String str("Hello");
133132
str = buffer;
134133
REQUIRE(str.compareTo("Hello") == 0);
134+
}
135+
136+
TEST_CASE ("Testing & String::operator = (const String &) with invalid buffer of first string", "[String-operator+-15]")
137+
{
138+
char *buffer1 = NULL;
139+
arduino::String str1(buffer1);
140+
141+
arduino::String str2("Hello");
142+
143+
str1 = str2;
144+
REQUIRE(str1.compareTo(str2) == 0);
135145
}

0 commit comments

Comments
 (0)