@@ -27,13 +27,13 @@ TEST_CASE ("Testing String::compareTo(const String &)", "[String-compareTo-01]")
27
27
WHEN (" str2 is empty" )
28
28
{
29
29
arduino::String str1 (" Hello" ), str2;
30
- REQUIRE (str1.compareTo (str2) == strcmp (str1. c_str (), str2. c_str ()) );
30
+ REQUIRE (str1.compareTo (str2) > 0 );
31
31
}
32
32
33
33
WHEN (" str1 is empty" )
34
34
{
35
35
arduino::String str1, str2 (" Hello" );
36
- REQUIRE (str1.compareTo (str2) == strcmp (str1. c_str (), str2. c_str ()) );
36
+ REQUIRE (str1.compareTo (str2) < 0 );
37
37
}
38
38
}
39
39
@@ -47,14 +47,14 @@ TEST_CASE ("Testing String::compareTo(const char *)", "[String-compareTo-02]")
47
47
48
48
WHEN (" Passed string is empty" )
49
49
{
50
- arduino::String str1 (" Hello" ), str2 ( " " );
51
- REQUIRE (str1 .compareTo (" " ) == strcmp (str1. c_str (), str2. c_str ()) );
50
+ arduino::String str (" Hello" );
51
+ REQUIRE (str .compareTo (" " ) > 0 );
52
52
}
53
53
54
54
WHEN (" Passed string is compared with empty string" )
55
55
{
56
- arduino::String str1, str2 ( " Hello " ) ;
57
- REQUIRE (str1 .compareTo (" Hello " ) == strcmp (str1. c_str (), str2. c_str ()) );
56
+ arduino::String str ;
57
+ REQUIRE (str .compareTo (" " ) == 0 );
58
58
}
59
59
}
60
60
@@ -64,17 +64,17 @@ TEST_CASE ("Testing String::compareTo(const char *) with empty buffer", "[String
64
64
{
65
65
char *buffer = NULL ;
66
66
67
- arduino::String str1 (" Hello" );
68
- REQUIRE (str1 .compareTo (buffer) != 0 );
67
+ arduino::String str (" Hello" );
68
+ REQUIRE (str .compareTo (buffer) != 0 );
69
69
}
70
70
71
71
WHEN (" First string does NOT have a valid buffer" )
72
72
{
73
73
char *buffer1 = NULL ;
74
74
char *buffer2 = NULL ;
75
75
76
- arduino::String str1 (buffer1);
77
- REQUIRE (str1 .compareTo (buffer2) == 0 );
76
+ arduino::String str (buffer1);
77
+ REQUIRE (str .compareTo (buffer2) == 0 );
78
78
}
79
79
}
80
80
0 commit comments