File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -121,15 +121,23 @@ TEST_CASE ("Testing & String::operator = (const String &) with invalid buffer of
121121 REQUIRE (str1.compareTo (str2) == 0 );
122122}
123123
124- TEST_CASE (" Testing & String::operator = (const char *)" , " [String-operator+-14]" )
124+ TEST_CASE (" Testing & String::operator = (const char *) with NULL does not leave string unchanged " , " [String-operator+-14]" )
125125{
126126 char *buffer = NULL ;
127127 arduino::String str (" Hello" );
128128 str = buffer;
129129 REQUIRE (str.compareTo (" Hello" ) != 0 );
130130}
131131
132- TEST_CASE (" Testing & String::operator = (const String &) with invalid buffer of first string" , " [String-operator+-15]" )
132+ TEST_CASE (" Testing & String::operator = (const char *) with NULL produces invalid string" , " [String-operator+-14]" )
133+ {
134+ char *buffer = NULL ;
135+ arduino::String str (" Hello" );
136+ str = buffer;
137+ REQUIRE_FALSE (str);
138+ }
139+
140+ TEST_CASE (" Testing & String::operator = (const String &) on invalid String updates it" , " [String-operator+-15]" )
133141{
134142 char *buffer1 = NULL ;
135143 arduino::String str1 (buffer1);
@@ -140,6 +148,17 @@ TEST_CASE ("Testing & String::operator = (const String &) with invalid buffer of
140148 REQUIRE (str1.compareTo (str2) == 0 );
141149}
142150
151+ TEST_CASE (" Testing & String::operator = (const String &) on invalid String makes it valid" , " [String-operator+-15]" )
152+ {
153+ char *buffer1 = NULL ;
154+ arduino::String str1 (buffer1);
155+
156+ arduino::String str2 (" Hello" );
157+
158+ str1 = str2;
159+ REQUIRE (str1);
160+ }
161+
143162TEST_CASE (" Testing & String::operator = (String &&)" , " [String-operator+-16]" )
144163{
145164 arduino::String str (" Hello" );
You can’t perform that action at this time.
0 commit comments