Skip to content

Commit 9d78148

Browse files
Add tests for String operator == and !=
This expands the existing tests for String.equals to also test operator == and !=. These should be equivalent (the operators just call equals), but add tests to ensure this.
1 parent 0c8dbd6 commit 9d78148

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

test/src/String/test_comparisonFunc.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,33 @@
1919
TEST_CASE ("Testing String::equals(const String &) with exit status PASS", "[String-equals-01]")
2020
{
2121
arduino::String str1("Hello"), str2("Hello");
22-
REQUIRE(str1.equals(str2) == 1);
22+
CHECK(str1.equals(str2) == 1);
23+
CHECK(str1 == str2);
24+
CHECK_FALSE(str1 != str2);
2325
}
2426

2527
TEST_CASE ("Testing String::equals(const String &) with exit status FAIL", "[String-equals-02]")
2628
{
2729
arduino::String str1("Hello"), str2("World");
28-
REQUIRE(str1.equals(str2) == 0);
30+
CHECK(str1.equals(str2) == 0);
31+
CHECK(str1 != str2);
32+
CHECK_FALSE(str1 == str2);
2933
}
3034

3135
TEST_CASE ("Testing String::equals(const char *) with exit status PASS", "[String-equals-03]")
3236
{
3337
arduino::String str1("Hello");
34-
REQUIRE(str1.equals("Hello") == 1);
38+
CHECK(str1.equals("Hello") == 1);
39+
CHECK(str1 == "Hello");
40+
CHECK_FALSE(str1 != "Hello");
3541
}
3642

3743
TEST_CASE ("Testing String::equals(const char *) with exit status FAIL", "[String-equals-04]")
3844
{
3945
arduino::String str1("Hello");
40-
REQUIRE(str1.equals("World") == 0);
46+
CHECK(str1.equals("World") == 0);
47+
CHECK(str1 != "World");
48+
CHECK_FALSE(str1 == "World");
4149
}
4250

4351
TEST_CASE ("Testing String::equalsIgnoreCase(const String &) PASS with NON-empty string", "[String-equalsIgnoreCase-05]")

0 commit comments

Comments
 (0)