From b5a44c70ee0f692e56c5c70e1335181b9cdd4a15 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 20 Dec 2024 12:04:41 +0100 Subject: [PATCH] parameters.yml in class, correct extension: yml and not yaml --- .../solver/modeler/parameters/parseModelerParameters.h | 2 +- src/solver/modeler/parameters/parseModelerParameters.cpp | 4 ++-- .../solver/modeler/parameters/testParametersParsing.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/solver/modeler/parameters/include/antares/solver/modeler/parameters/parseModelerParameters.h b/src/solver/modeler/parameters/include/antares/solver/modeler/parameters/parseModelerParameters.h index a323b39b0f..441c9c8deb 100644 --- a/src/solver/modeler/parameters/include/antares/solver/modeler/parameters/parseModelerParameters.h +++ b/src/solver/modeler/parameters/include/antares/solver/modeler/parameters/parseModelerParameters.h @@ -28,6 +28,6 @@ namespace Antares::Solver { -ModelerParameters parseModelerParameters(const std::filesystem::path& path); +ModelerParameters parseModelerParameters(const std::filesystem::path& studyPath); } // namespace Antares::Solver diff --git a/src/solver/modeler/parameters/parseModelerParameters.cpp b/src/solver/modeler/parameters/parseModelerParameters.cpp index 2c92ff6d53..a42050dab9 100644 --- a/src/solver/modeler/parameters/parseModelerParameters.cpp +++ b/src/solver/modeler/parameters/parseModelerParameters.cpp @@ -29,9 +29,9 @@ namespace Antares::Solver { -ModelerParameters parseModelerParameters(const std::filesystem::path& path) +ModelerParameters parseModelerParameters(const std::filesystem::path& studyPath) { - const auto contents = Antares::IO::readFile(path); + const auto contents = Antares::IO::readFile(studyPath / "parameters.yml"); YAML::Node root = YAML::Load(contents); return root.as(); } diff --git a/src/tests/src/solver/modeler/parameters/testParametersParsing.cpp b/src/tests/src/solver/modeler/parameters/testParametersParsing.cpp index aa2b14732b..786ca627d4 100644 --- a/src/tests/src/solver/modeler/parameters/testParametersParsing.cpp +++ b/src/tests/src/solver/modeler/parameters/testParametersParsing.cpp @@ -34,7 +34,7 @@ BOOST_AUTO_TEST_SUITE(read_modeler_parameters) BOOST_AUTO_TEST_CASE(all_properties_set) { const auto working_tmp_dir = CREATE_TMP_DIR_BASED_ON_TEST_NAME(); - const auto fileP = working_tmp_dir / "parameters.yaml"; + const auto fileP = working_tmp_dir / "parameters.yml"; { std::ofstream param(fileP); param << R"( @@ -44,7 +44,7 @@ solver-parameters: PRESOLVE 1 no-output: true)"; } - auto params = Antares::Solver::parseModelerParameters(fileP); + auto params = Antares::Solver::parseModelerParameters(working_tmp_dir); BOOST_CHECK_EQUAL(params.solver, "sirius"); BOOST_CHECK_EQUAL(params.solverLogs, false); BOOST_CHECK_EQUAL(params.solverParameters, "PRESOLVE 1"); @@ -54,7 +54,7 @@ no-output: true)"; BOOST_AUTO_TEST_CASE(all_properties_set_out_of_order) { const auto working_tmp_dir = CREATE_TMP_DIR_BASED_ON_TEST_NAME(); - const auto fileP = working_tmp_dir / "parameters.yaml"; + const auto fileP = working_tmp_dir / "parameters.yml"; { std::ofstream param(fileP); param << R"( @@ -64,7 +64,7 @@ solver-parameters: PRESOLVE 1 no-output: true)"; } - auto params = Antares::Solver::parseModelerParameters(fileP); + auto params = Antares::Solver::parseModelerParameters(working_tmp_dir); BOOST_CHECK_EQUAL(params.solver, "sirius"); BOOST_CHECK_EQUAL(params.solverLogs, false); BOOST_CHECK_EQUAL(params.solverParameters, "PRESOLVE 1");