Changeset d49bae9 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:
- 035a35c
- Parents:
- 509738fd
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-11-02 20:31: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
r509738fd rd49bae9 73 73 void test_copy(); 74 74 void test_find(); 75 void test_substr(); 75 76 }; 76 77 } -
uspace/lib/cpp/src/internal/test/string.cpp
r509738fd rd49bae9 45 45 test_copy(); 46 46 test_find(); 47 test_substr(); 47 48 48 49 return end(); … … 634 635 ); 635 636 } 637 638 void string_test::test_substr() 639 { 640 std::string check1{"abcd"}; 641 std::string check2{"bcd"}; 642 std::string check3{"def"}; 643 644 std::string str{"abcdef"}; 645 auto substr1 = str.substr(0, 4); 646 auto substr2 = str.substr(1, 3); 647 auto substr3 = str.substr(3); 648 649 test_eq( 650 "prefix substring", 651 substr1.begin(), substr1.end(), 652 check1.begin(), check1.end() 653 ); 654 655 test_eq( 656 "substring", 657 substr2.begin(), substr2.end(), 658 check2.begin(), check2.end() 659 ); 660 661 test_eq( 662 "suffix substring", 663 substr3.begin(), substr3.end(), 664 check3.begin(), check3.end() 665 ); 666 } 636 667 }
Note:
See TracChangeset
for help on using the changeset viewer.