MCPcopy Create free account
hub / github.com/AimRT/AimRT / TestSplitToVec

Function TestSplitToVec

src/common/util/string_util_test.cc:729–847  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727
728template <class StringType>
729void TestSplitToVec() {
730 struct TestCase {
731 std::string name;
732
733 std::string_view source;
734 std::string_view sep;
735 bool trim;
736 bool clear;
737
738 std::vector<StringType> want_result;
739 };
740 std::vector<TestCase> test_cases;
741
742 test_cases.emplace_back(
743 TestCase{
744 .name = "case 1",
745 .source = "v1, , v3,v4,,v6",
746 .sep = ",",
747 .trim = true,
748 .clear = false,
749 .want_result = {"v1", "", "v3", "v4", "", "v6"}});
750 test_cases.emplace_back(
751 TestCase{
752 .name = "case 2",
753 .source = "v1, , v3,v4,,v6",
754 .sep = ",",
755 .trim = false,
756 .clear = false,
757 .want_result = {"v1", " ", " v3", "v4", "", "v6"}});
758 test_cases.emplace_back(
759 TestCase{
760 .name = "case 3",
761 .source = "v1, , v3,v4,,v6",
762 .sep = ",",
763 .trim = true,
764 .clear = true,
765 .want_result = {"v1", "v3", "v4", "v6"}});
766 test_cases.emplace_back(
767 TestCase{
768 .name = "case 4",
769 .source = "v1, , v3,v4,,v6",
770 .sep = ",",
771 .trim = false,
772 .clear = true,
773 .want_result = {"v1", " ", " v3", "v4", "v6"}});
774
775 test_cases.emplace_back(
776 TestCase{
777 .name = "bad case 1",
778 .source = "",
779 .sep = ",",
780 .trim = false,
781 .clear = false,
782 .want_result = {}});
783 test_cases.emplace_back(
784 TestCase{
785 .name = "bad case 2",
786 .source = " ",

Callers

nothing calls this directly

Calls 1

CheckContainerEqualFunction · 0.85

Tested by

no test coverage detected