File tree 2 files changed +39
-0
lines changed
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ set(TEST_SRCS
46
46
src/String /test_compareTo.cpp
47
47
src/String /test_comparisonFunc.cpp
48
48
src/String /test_characterAccessFunc.cpp
49
+ src/String /test_substring.cpp
49
50
src/String /test_indexOf.cpp
50
51
src/String /test_lastIndexOf.cpp
51
52
src/String /test_length.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::substring(unsigned int, unsigned int)" , " [String-substring-01]" )
18
+ {
19
+ WHEN (" left higher than len" )
20
+ {
21
+ arduino::String str (" Hello" );
22
+ str.substring (7 ,9 );
23
+ }
24
+
25
+ WHEN (" right higher than len" )
26
+ {
27
+ arduino::String str1 (" Hello" );
28
+ arduino::String str2 (" ello" );
29
+ REQUIRE (str2.compareTo (str1.substring (1 ,9 )) == 0 );
30
+ }
31
+
32
+ WHEN (" left higher than right" )
33
+ {
34
+ arduino::String str1 (" Hello" );
35
+ arduino::String str2 (" ello" );
36
+ REQUIRE (str2.compareTo (str1.substring (9 ,1 )) == 0 );
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments