| 28 | { |
| 29 | |
| 30 | Json::Value read_json(const std::string &filename) |
| 31 | { |
| 32 | Json::Value root; |
| 33 | std::ifstream ifs(filename); |
| 34 | |
| 35 | // Failed to open cfg file |
| 36 | if (not ifs.is_open()) |
| 37 | throw std::runtime_error("Cannot open config file. " + filename); |
| 38 | |
| 39 | Json::CharReaderBuilder builder; |
| 40 | JSONCPP_STRING errs; |
| 41 | |
| 42 | // Failed to parse |
| 43 | if (not parseFromStream(builder, ifs, &root, &errs)) |
| 44 | throw std::runtime_error("Cannot parse config file (json format). " + errs); |
| 45 | |
| 46 | return root; |
| 47 | } |
| 48 | |
| 49 | class EqualizePatternWriteTest : public ::testing::Test |
| 50 | { |
no test coverage detected