Skip to content

Commit db294c0

Browse files
committed
Add test code for String(String &&) and String(StringSumHelper &&)
1 parent 6d9db81 commit db294c0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/src/String/test_String.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,26 @@ TEST_CASE ("Testing String(const __FlashStringHelper) constructor() with invalid
101101
arduino::String str1(F(buffer));
102102
REQUIRE(str1.compareTo("Hello") == 0);
103103
}
104+
105+
TEST_CASE ("Testing String(StringSumHelper &&) constructor()", "[String-Ctor-13]")
106+
{
107+
arduino::String str("Hello");
108+
char const ch = '!';
109+
arduino::String str1(static_cast<arduino::StringSumHelper&&>(str+ch));
110+
REQUIRE(str1.compareTo("Hello!") == 0);
111+
}
112+
113+
TEST_CASE ("Testing String(String &&) constructor()", "[String-Ctor-14]")
114+
{
115+
arduino::String str("Hello");
116+
arduino::String str1(static_cast<arduino::String&&>(str));
117+
REQUIRE(str1.compareTo("Hello") == 0);
118+
}
119+
120+
TEST_CASE ("Testing String(String &&) with move(String &rhs) to a valid buffer", "[String-Ctor-15]")
121+
{
122+
arduino::String str("Hello");
123+
arduino::String str1("Arduino");
124+
str1 = static_cast<arduino::String&&>(str);
125+
REQUIRE(str1.compareTo("Hello") == 0);
126+
}

0 commit comments

Comments
 (0)