| 602 | } |
| 603 | |
| 604 | bool testSort() |
| 605 | { |
| 606 | std::cout << "testSort()"; |
| 607 | |
| 608 | bool result = true; |
| 609 | |
| 610 | using SortConfiguration = cmList::SortConfiguration; |
| 611 | |
| 612 | { |
| 613 | cmList list{ "A", "D", "C", "B", "A" }; |
| 614 | |
| 615 | list.sort(); |
| 616 | if (list.to_string() != "A;A;B;C;D") { |
| 617 | result = false; |
| 618 | } |
| 619 | |
| 620 | list.sort({ SortConfiguration::OrderMode::DESCENDING, |
| 621 | SortConfiguration::CompareMethod::DEFAULT, |
| 622 | SortConfiguration::CaseSensitivity::DEFAULT }); |
| 623 | if (list.to_string() != "D;C;B;A;A") { |
| 624 | result = false; |
| 625 | } |
| 626 | } |
| 627 | { |
| 628 | SortConfiguration sortCfg; |
| 629 | cmList list{ "1.0", "1.1", "2.5", "10.2" }; |
| 630 | |
| 631 | list.sort(sortCfg); |
| 632 | if (list.to_string() != "1.0;1.1;10.2;2.5") { |
| 633 | result = false; |
| 634 | } |
| 635 | |
| 636 | sortCfg.Compare = SortConfiguration::CompareMethod::NATURAL; |
| 637 | list.sort(sortCfg); |
| 638 | if (list.to_string() != "1.0;1.1;2.5;10.2") { |
| 639 | result = false; |
| 640 | } |
| 641 | |
| 642 | sortCfg.Order = SortConfiguration::OrderMode::DESCENDING; |
| 643 | list.sort(sortCfg); |
| 644 | if (list.to_string() != "10.2;2.5;1.1;1.0") { |
| 645 | result = false; |
| 646 | } |
| 647 | } |
| 648 | { |
| 649 | SortConfiguration sortCfg; |
| 650 | cmList list{ "/zz/bb.cc", "/xx/yy/dd.cc", "/aa/cc.aa" }; |
| 651 | |
| 652 | list.sort(sortCfg); |
| 653 | if (list.to_string() != "/aa/cc.aa;/xx/yy/dd.cc;/zz/bb.cc") { |
| 654 | result = false; |
| 655 | } |
| 656 | |
| 657 | sortCfg.Compare = SortConfiguration::CompareMethod::FILE_BASENAME; |
| 658 | if (list.sort(sortCfg).to_string() != "/zz/bb.cc;/aa/cc.aa;/xx/yy/dd.cc") { |
| 659 | result = false; |
| 660 | } |
| 661 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…