Go to the source code of this file.
◆ TEST_CASE() [1/17]
Definition at line 4 of file string_test.cpp.
4 {
5 CHECK_EQ (
string (
"abc") ==
"abc",
true);
6 CHECK_EQ (
string (
"abc") ==
"",
false);
7
8 CHECK_EQ (
string (
"abc") !=
"abc",
false);
9 CHECK_EQ (
string (
"abc") !=
"",
true);
10
11 CHECK_EQ (
string (
"abc") ==
string (
"abc"),
true);
12 CHECK_EQ (
string (
"abc") ==
string (),
false);
13 CHECK_EQ (
string (
"abc") !=
string (
"abc"),
false);
14 CHECK_EQ (
string (
"abc") !=
string (),
true);
15
16 CHECK_EQ (
string () ==
string (),
true);
17}
The list class represents a linked list.
◆ TEST_CASE() [2/17]
Definition at line 19 of file string_test.cpp.
19 {
20 CHECK (
string (
"ab") <
string (
"b"));
21 CHECK (
string () <
string (
"0"));
22 CHECK (
string (
"a") <=
string (
"a"));
23 CHECK (
string (
"ab") <=
string (
"b"));
24 CHECK (
string () <=
string ());
25 CHECK (
string () <=
string (
"0"));
26}
◆ TEST_CASE() [3/17]
Definition at line 28 of file string_test.cpp.
28 {
29 CHECK_EQ (
string (
"abcde") (0, 0) ==
string (),
true);
30 CHECK_EQ (
string (
"abcde") (0, 1) ==
string (
"a"),
true);
31 CHECK_EQ (
string (
"abcde") (0, 10) ==
string (
"abcde"),
true);
32 CHECK_EQ (
string (
"abcde") (-1, 1) ==
string (
"a"),
true);
33 CHECK_EQ (
string (
"abcde") (3, 2) ==
string (),
true);
34 CHECK_EQ (
string (
"abcde") (3, -2) ==
string (),
true);
35 CHECK_EQ (
string (
"abcde") (10, 11) ==
string (),
true);
36 CHECK_EQ (
string (
"abcde") (-3, -2) ==
string (),
true);
37}
◆ TEST_CASE() [4/17]
Definition at line 39 of file string_test.cpp.
39 {
40 CHECK_EQ (
string (
"abc") *
"de" ==
string (
"abcde"),
true);
41 CHECK_EQ (
string (
"abc") *
string (
"de") ==
string (
"abcde"),
true);
42 CHECK_EQ (
"abc" *
string (
"de") ==
string (
"abcde"),
true);
43}
◆ TEST_CASE() [5/17]
Definition at line 45 of file string_test.cpp.
45 {
46 string str1 =
"s\0tr1";
51 }
53}
int N(array< T > a)
Get the length of the array.
◆ TEST_CASE() [6/17]
◆ TEST_CASE() [7/17]
Definition at line 75 of file string_test.cpp.
75 {
76
77 SUBCASE (
"reserved more space") {
79 str->reserve (6);
80 str << 'x';
84 str <<
string (
": larger than reserved space");
85 CHECK_EQ (str ==
"xyz: larger than reserved space",
true);
86 }
87 SUBCASE (
"reserved the same space") {
89 str->reserve (3);
91 }
92 SUBCASE (
"reserved less space should take no effect") {
94 str->reserve (2);
96 }
97}
◆ TEST_CASE() [8/17]
Definition at line 99 of file string_test.cpp.
99 {
100
102 auto str =
string (
"abc");
105 str[3]= 'd';
107 }
109 auto str =
string (
"abc");
110 int previous_n= str->expand_or_shrink_by (-1);
113 }
114 SUBCASE (
"delta 0 takes no effect") {
115 auto str =
string (
"abc");
119 }
120}
◆ TEST_CASE() [9/17]
Definition at line 122 of file string_test.cpp.
122 {
123
126 str->resize (4);
127 str[3]= 'd';
129 }
132 str->resize (2);
134 }
135 SUBCASE (
"delta 0 takes no effect") {
137 str->resize (3);
139 }
140}
◆ TEST_CASE() [10/17]
◆ TEST_CASE() [11/17]
Definition at line 157 of file string_test.cpp.
157 {
158 SUBCASE (
"normal conversion") {
163 }
164
165
169 }
170
174 }
175
181 }
182}
SI as_int(double x)
Converts a double to a signed integer, rounding to the nearest integer.
◆ TEST_CASE() [12/17]
Definition at line 184 of file string_test.cpp.
184 {
185 SUBCASE (
"normal conversion") {
190 }
191
192
196 }
197
201 }
202
208 }
209}
◆ TEST_CASE() [13/17]
◆ TEST_CASE() [14/17]
◆ TEST_CASE() [15/17]
◆ TEST_CASE() [16/17]
Definition at line 236 of file string_test.cpp.
236 {
237
239
240
241 for (auto i= 0; i < 256; i++) {
245 }
246
247
253}
◆ TEST_CASE() [17/17]