| 31 | }; |
| 32 | |
| 33 | static std::vector<phase7_case> load_cases(const std::string & path) { |
| 34 | std::vector<phase7_case> cases; |
| 35 | std::ifstream f(path); |
| 36 | std::string line; |
| 37 | while (std::getline(f, line)) { |
| 38 | if (line.empty()) { |
| 39 | continue; |
| 40 | } |
| 41 | std::vector<std::string> fields; |
| 42 | size_t start = 0; |
| 43 | while (start <= line.size()) { |
| 44 | size_t end = line.find('\t', start); |
| 45 | if (end == std::string::npos) { |
| 46 | end = line.size(); |
| 47 | } |
| 48 | fields.push_back(line.substr(start, end - start)); |
| 49 | start = end + 1; |
| 50 | if (end == line.size()) { |
| 51 | break; |
| 52 | } |
| 53 | } |
| 54 | while (fields.size() < 2) { |
| 55 | fields.emplace_back(); |
| 56 | } |
| 57 | cases.push_back({fields[0], fields[1]}); |
| 58 | } |
| 59 | return cases; |
| 60 | } |
| 61 | |
| 62 | static std::map<std::string, std::string> load_meta(const std::string & path) { |
| 63 | std::map<std::string, std::string> kv; |