MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / load_cases

Function load_cases

tests/test_phase6.cpp:75–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75static std::vector<phase6_case> load_cases(const std::string & path) {
76 std::vector<phase6_case> cases;
77 std::ifstream f(path);
78 std::string line;
79 while (std::getline(f, line)) {
80 if (line.empty()) {
81 continue;
82 }
83
84 std::vector<std::string> fields;
85 size_t start = 0;
86 while (start <= line.size()) {
87 size_t end = line.find('\t', start);
88 if (end == std::string::npos) {
89 end = line.size();
90 }
91 fields.push_back(line.substr(start, end - start));
92 start = end + 1;
93 if (end == line.size()) {
94 break;
95 }
96 }
97 while (fields.size() < 5) {
98 fields.emplace_back();
99 }
100
101 phase6_case tc;
102 tc.id = fields[0];
103 tc.params.multimask = fields[1] == "1";
104 tc.params.pos_points = parse_points(fields[2]);
105 tc.params.neg_points = parse_points(fields[3]);
106 tc.params.use_box = parse_box(fields[4], tc.params.box);
107 cases.push_back(std::move(tc));
108 }
109 return cases;
110}
111
112static std::vector<tensor_case> tensor_cases() {
113 return {

Callers 1

mainFunction · 0.70

Calls 2

parse_pointsFunction · 0.70
parse_boxFunction · 0.70

Tested by

no test coverage detected