@@ -81,6 +81,8 @@ TEST(string_tensor, ctor) {
8181 tensor_3 = std::move (tensor_1);
8282 CHECK_EQ (tensor_3.data ()[0 ], plong_str);
8383 CHECK_EQ (tensor_3.data ()[1 ], pshort_str);
84+ 
85+  tensor_3.set_meta (meta);
8486}
8587
8688TEST (pstring, func) {
@@ -92,6 +94,7 @@ TEST(pstring, func) {
9294 CHECK_EQ (nchar_str, " AAAAA" 
9395 CHECK_EQ (copy_nchar_str, " AAAAA" 
9496
97+  //  Test Move Ctor
9598 pstring move_nchar_str (std::move (nchar_str));
9699 CHECK_EQ (move_nchar_str, " AAAAA" 
97100 pstring std_str (std::string (" BBBB" 
@@ -127,6 +130,16 @@ TEST(pstring, func) {
127130 //  Test capacity
128131 CHECK_EQ (short_str.capacity (), 22UL );
129132
133+  //  Test reserve
134+  pstring reserve_str;
135+  CHECK_EQ (reserve_str.capacity (), 22UL );
136+  //  small -> large
137+  reserve_str.reserve (100 );
138+  CHECK_EQ (reserve_str.capacity (), 111UL ); //  align(100) - 1 = 111
139+  //  reserve more memory
140+  reserve_str.reserve (200 );
141+  CHECK_EQ (reserve_str.capacity (), 207UL ); //  align(200) - 1 = 207
142+ 
130143 //  Test operator<<
131144 std::ostringstream oss1, oss2;
132145 oss1 << long_str;
@@ -143,14 +156,10 @@ TEST(pstring, func) {
143156 CHECK_EQ ((long_str > short_str), false );
144157 CHECK_EQ ((long_str == short_str), false );
145158 CHECK_EQ ((long_str != short_str), true );
146- 
147-  //  Test operator =
148-  long_str = short_str;
149-  CHECK_EQ (short_str, long_str);
150-  short_str = ' A' 
151-  CHECK_EQ (short_str, " A" 
152-  short_str = std::move (copy_nchar_str);
153-  CHECK_EQ (short_str, " AAAAA" 
159+  CHECK_EQ ((short_str < long_str), false );
160+  CHECK_EQ ((short_str > long_str), true );
161+  CHECK_EQ ((move_nchar_str < plus_str), true );
162+  CHECK_EQ ((plus_str > move_nchar_str), true );
154163
155164 //  Test empty
156165 CHECK_EQ (empty_str.empty (), true );
@@ -160,6 +169,16 @@ TEST(pstring, func) {
160169 //  Test Resize
161170 nchar_str.resize (6 , ' B' 
162171 CHECK_EQ (nchar_str, " AAAAAB" 
172+ 
173+  //  Test operator =
174+  long_str = short_str;
175+  CHECK_EQ (short_str, long_str);
176+  short_str = ' A' 
177+  CHECK_EQ (short_str, " A" 
178+  short_str = std::move (copy_nchar_str);
179+  CHECK_EQ (short_str, " AAAAA" 
180+  long_str = std::move (nchar_str);
181+  CHECK_EQ (long_str, " AAAAAB" 
163182}
164183
165184} //  namespace tests
0 commit comments