| 64 | } |
| 65 | |
| 66 | static 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 | |
| 104 | static const std::vector<tensor_case> & tensor_cases() { |
| 105 | static const std::vector<tensor_case> cases = { |
no test coverage detected