Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1cf220b

Browse files
committed
Add test case for String::compareTo() with empty buffer
1 parent3af6c3c commit1cf220b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

‎test/src/String/test_compareTo.cpp‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,46 @@ TEST_CASE ("Testing String::compareTo(const char *)", "[String-compareTo-02]")
5555
REQUIRE(str1.compareTo("Hello") ==strcmp(str1.c_str(), str2.c_str()));
5656
}
5757
}
58+
59+
TEST_CASE ("Testing String::compareTo(const char *) with empty buffer","[String-compareTo-03]")
60+
{
61+
WHEN ("First string has a valid buffer")
62+
{
63+
char *buffer =NULL;
64+
65+
arduino::Stringstr1("Hello");
66+
REQUIRE(str1.compareTo(buffer) !=0);
67+
}
68+
69+
WHEN ("First string does NOT have a valid buffer")
70+
{
71+
char *buffer1 =NULL;
72+
char *buffer2 =NULL;
73+
74+
arduino::Stringstr1(buffer1);
75+
REQUIRE(str1.compareTo(buffer2) ==0);
76+
}
77+
}
78+
79+
80+
TEST_CASE ("Testing String::compareTo(const String &) with empty buffer","[String-compareTo-04]")
81+
{
82+
WHEN ("First string has a valid buffer")
83+
{
84+
char *buffer =NULL;
85+
86+
arduino::Stringstr1("Hello");
87+
arduino::Stringstr2(buffer);
88+
REQUIRE(str1.compareTo(str2) !=0);
89+
}
90+
91+
WHEN ("First string does NOT have a valid buffer")
92+
{
93+
char *buffer1 =NULL;
94+
char *buffer2 =NULL;
95+
96+
arduino::Stringstr1(buffer1);
97+
arduino::Stringstr2(buffer2);
98+
REQUIRE(str1.compareTo(str2) ==0);
99+
}
100+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp