@@ -99,4 +99,58 @@ TEST_CASE ("Testing String::operator + (const __FlashStringHelper *)", "[String-
9999 arduino::String str1 (" Hello " );
100100 arduino::String str (" Hello Arduino" );
101101 REQUIRE (str.compareTo (str1+F (" Arduino" )) == 0 );
102+ }
103+
104+ TEST_CASE (" Testing & String::operator = (StringSumHelper &&rval)" , " [String-operator+-12]" )
105+ {
106+ arduino::String str1 (" Hello " );
107+ arduino::String str = (str1+" Arduino" );
108+ REQUIRE (str.compareTo (" Hello Arduino" ) == 0 );
109+ }
110+
111+ TEST_CASE (" Testing & String::operator = (const String &) with invalid buffer of second string" , " [String-operator+-13]" )
112+ {
113+ arduino::String str1 (" Hello" );
114+
115+ char *buffer2 = NULL ;
116+ arduino::String str2 (buffer2);
117+
118+ str1 = str2;
119+ REQUIRE (str1.compareTo (str2) == 0 );
120+ }
121+
122+ TEST_CASE (" Testing & String::operator = (const char *)" , " [String-operator+-14]" )
123+ {
124+ char *buffer = NULL ;
125+ arduino::String str (" Hello" );
126+ str = buffer;
127+ REQUIRE (str.compareTo (" Hello" ) == 0 );
128+ }
129+
130+ TEST_CASE (" Testing & String::operator = (const String &) with invalid buffer of first string" , " [String-operator+-15]" )
131+ {
132+ char *buffer1 = NULL ;
133+ arduino::String str1 (buffer1);
134+
135+ arduino::String str2 (" Hello" );
136+
137+ str1 = str2;
138+ REQUIRE (str1.compareTo (str2) == 0 );
139+ }
140+
141+ TEST_CASE (" Testing & String::operator = (String &&)" , " [String-operator+-16]" )
142+ {
143+ arduino::String str (" Hello" );
144+ arduino::String str1 (" Arduino" );
145+ str1 = static_cast <arduino::String&&>(str);
146+ REQUIRE (str1.compareTo (" Hello" ) == 0 );
147+ }
148+
149+ TEST_CASE (" Testing & String::operator = (StringSumHelper &&)" , " [String-operator+-17]" )
150+ {
151+ arduino::String str (" Hello" );
152+ char const ch = ' !' ;
153+ arduino::String str1 (" Arduino" );
154+ str1 = static_cast <arduino::StringSumHelper&&>(str+ch);
155+ REQUIRE (str1.compareTo (" Hello!" ) == 0 );
102156}
0 commit comments