| 495 | } |
| 496 | |
| 497 | void add_cases(std::filesystem::path const& case_dir, std::string const& calculation_type, bool is_batch, |
| 498 | std::vector<CaseParam>& cases) { |
| 499 | using namespace std::string_literals; |
| 500 | |
| 501 | std::filesystem::path const param_file = case_dir / "params.json"; |
| 502 | json const j = read_json(param_file); |
| 503 | // calculation method a string or array of strings |
| 504 | std::vector<std::string> calculation_methods; |
| 505 | if (j.at("calculation_method").type() == json::value_t::array) { |
| 506 | j.at("calculation_method").get_to(calculation_methods); |
| 507 | } else { |
| 508 | calculation_methods.push_back(j.at("calculation_method").get<std::string>()); |
| 509 | } |
| 510 | // loop sym and batch |
| 511 | for (bool const sym : {true, false}) { |
| 512 | for (auto const& calculation_method : calculation_methods) { |
| 513 | if (calculation_method == "iec60909"s && sym) { |
| 514 | continue; // only asym short circuit calculations are supported |
| 515 | } |
| 516 | |
| 517 | CHECK_NOTHROW([&]() { |
| 518 | if (auto test_case = construct_case(case_dir, j, calculation_type, is_batch, calculation_method, sym)) { |
| 519 | cases.push_back(*std::move(test_case)); |
| 520 | } |
| 521 | }()); |
| 522 | } |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | // test case with parameter |
| 527 | struct ValidationCase { |
no test coverage detected