Changeset e502572b in mainline
- Timestamp:
- 2018-07-05T21:41:18Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 417296cd
- Parents:
- ed81b1f
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-11-01 19:16:38)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:18)
- Location:
- uspace/lib/cpp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/internal/test/tests.hpp
red81b1f re502572b 69 69 void test_append(); 70 70 void test_insert(); 71 void test_erase(); 71 72 }; 72 73 } -
uspace/lib/cpp/src/internal/test/string.cpp
red81b1f re502572b 39 39 test_append(); 40 40 test_insert(); 41 test_erase(); 41 42 42 43 return true; … … 203 204 ); 204 205 } 206 207 void string_test::test_erase() 208 { 209 std::string check{"hello"}; 210 211 std::string str1{"heXllo"}; 212 str1.erase(str1.begin() + 2); 213 test_eq( 214 "erase single char in the middle", 215 str1.begin(), str1.end(), 216 check.begin(), check.end() 217 ); 218 219 std::string str2{"Xhello"}; 220 str2.erase(str2.begin()); 221 test_eq( 222 "erase single char at the beginning", 223 str2.begin(), str2.end(), 224 check.begin(), check.end() 225 ); 226 227 std::string str3{"helloX"}; 228 str3.erase(str3.begin() + 5); 229 test_eq( 230 "erase single char at the end", 231 str3.begin(), str3.end(), 232 check.begin(), check.end() 233 ); 234 235 std::string str4{"XXXhello"}; 236 str4.erase(0, 3); 237 test_eq( 238 "erase string at the beginning", 239 str4.begin(), str4.end(), 240 check.begin(), check.end() 241 ); 242 243 std::string str5{"heXXXllo"}; 244 str5.erase(2, 3); 245 test_eq( 246 "erase string in the middle", 247 str5.begin(), str5.end(), 248 check.begin(), check.end() 249 ); 250 251 std::string str6{"helloXXX"}; 252 str6.erase(5); 253 test_eq( 254 "erase string at the end", 255 str6.begin(), str6.end(), 256 check.begin(), check.end() 257 ); 258 } 205 259 }
Note:
See TracChangeset
for help on using the changeset viewer.