Changeset 035a35c 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:
- 4e6fb2f
- Parents:
- d49bae9
- git-author:
- Jaroslav Jindrak <dzejrou@…> (2017-11-02 21:00:21)
- 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
rd49bae9 r035a35c 74 74 void test_find(); 75 75 void test_substr(); 76 void test_compare(); 76 77 }; 77 78 } -
uspace/lib/cpp/src/internal/test/string.cpp
rd49bae9 r035a35c 46 46 test_find(); 47 47 test_substr(); 48 test_compare(); 48 49 49 50 return end(); … … 665 666 ); 666 667 } 668 669 void string_test::test_compare() 670 { 671 std::string str1{"aabbb"}; 672 std::string str2{"bbbaa"}; 673 std::string str3{"bbb"}; 674 675 auto res = str1.compare(str1); 676 test_eq( 677 "compare equal", 678 res, 0 679 ); 680 681 res = str1.compare(str2.c_str()); 682 test_eq( 683 "compare less", 684 res, -1 685 ); 686 687 res = str2.compare(str1); 688 test_eq( 689 "compare greater", 690 res, 1 691 ); 692 693 res = str1.compare(2, 3, str2); 694 test_eq( 695 "compare substring less", 696 res, -1 697 ); 698 699 res = str1.compare(2, 3, str3); 700 test_eq( 701 "compare substring equal", 702 res, 0 703 ); 704 } 667 705 }
Note:
See TracChangeset
for help on using the changeset viewer.