Changeset 923b0c8f 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:
- d3bca35
- Parents:
- 173a246
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-11-01 21:02:29)
- 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
r173a246 r923b0c8f 72 72 void test_replace(); 73 73 void test_copy(); 74 void test_find(); 74 75 }; 75 76 } -
uspace/lib/cpp/src/internal/test/string.cpp
r173a246 r923b0c8f 42 42 test_replace(); 43 43 test_copy(); 44 test_find(); 44 45 45 46 return true; … … 387 388 ); 388 389 } 390 391 void string_test::test_find() 392 { 393 std::string target{"ABC"}; 394 auto miss = std::string::npos; 395 396 std::string str1{"xxABCxx"}; 397 398 auto idx = str1.find(target, 0); 399 test_eq( 400 "find from start (success)", 401 idx, 2ul 402 ); 403 404 idx = str1.find(target, 3); 405 test_eq( 406 "find from start (fail, late start)", 407 idx, miss 408 ); 409 410 idx = str1.rfind(target, miss); 411 test_eq( 412 "rfind from start (success)", 413 idx, 2ul 414 ); 415 416 idx = str1.rfind(target, 1); 417 test_eq( 418 "rfind from start (fail, late start)", 419 idx, miss 420 ); 421 422 std::string str2{"xxABCxxABCxx"}; 423 424 idx = str2.find(target, 0); 425 test_eq( 426 "find from start (success, multiple)", 427 idx, 2ul 428 ); 429 } 389 430 }
Note:
See TracChangeset
for help on using the changeset viewer.