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

Function load_cases

tests/test_metal_phase6.cpp:66–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 2

parse_pointsFunction · 0.70
parse_boxFunction · 0.70

Tested by

no test coverage detected