File tree 2 files changed +44
-0
lines changed
2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ set(TEST_SRCS
47
47
src/String /test_String.cpp
48
48
src/String /test_toLowerCase.cpp
49
49
src/String /test_toUpperCase.cpp
50
+ src/String /test_trim.cpp
50
51
src/WCharacter/test_isControl.cpp
51
52
src/WCharacter/test_isDigit.cpp
52
53
src/WCharacter/test_isHexadecimalDigit.cpp
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2020 Arduino. All rights reserved.
3
+ */
4
+
5
+ /* *************************************************************************************
6
+ * INCLUDE
7
+ **************************************************************************************/
8
+
9
+ #include < catch.hpp>
10
+
11
+ #include < String.h>
12
+
13
+ /* *************************************************************************************
14
+ * TEST CODE
15
+ **************************************************************************************/
16
+
17
+ TEST_CASE (" Testing String::trim with space at the beginning" , " [String-trim-01]" )
18
+ {
19
+ arduino::String str (" hello" );
20
+ str.trim ();
21
+ REQUIRE (strcmp (str.c_str (), " hello" ) == 0 );
22
+ }
23
+
24
+ TEST_CASE (" Testing String::trim with space at the end" , " [String-trim-02]" )
25
+ {
26
+ arduino::String str (" hello " );
27
+ str.trim ();
28
+ REQUIRE (strcmp (str.c_str (), " hello" ) == 0 );
29
+ }
30
+
31
+ TEST_CASE (" Testing String::trim with space at both beginng and end" , " [String-trim-03]" )
32
+ {
33
+ arduino::String str (" hello " );
34
+ str.trim ();
35
+ REQUIRE (strcmp (str.c_str (), " hello" ) == 0 );
36
+ }
37
+
38
+ TEST_CASE (" Testing String::trim with space in the middle" , " [String-trim-04]" )
39
+ {
40
+ arduino::String str (" Hello Arduino!" );
41
+ str.trim ();
42
+ REQUIRE (strcmp (str.c_str (), " Hello Arduino!" ) == 0 );
43
+ }
You can’t perform that action at this time.
0 commit comments