From 02f366f740f4ed85730581e5fa540cbb2519e2a2 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Fri, 20 Dec 2024 13:58:16 +0100 Subject: [PATCH] use namespace loadFiles for parameters --- src/solver/modeler/main.cpp | 2 +- .../solver/modeler/parameters/parseModelerParameters.h | 4 ++-- src/solver/modeler/parameters/parseModelerParameters.cpp | 4 ++-- .../src/solver/modeler/parameters/testParametersParsing.cpp | 6 ++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/solver/modeler/main.cpp b/src/solver/modeler/main.cpp index fc5f8d6ff6..ac28dbf124 100644 --- a/src/solver/modeler/main.cpp +++ b/src/solver/modeler/main.cpp @@ -43,7 +43,7 @@ int main(int argc, const char** argv) return EXIT_FAILURE; } - const auto parameters = parseModelerParameters(studyPath); + const auto parameters = LoadFiles::parseModelerParameters(studyPath); const auto libraries = LoadFiles::loadLibraries(studyPath); const auto system = LoadFiles::loadSystem(studyPath, libraries); 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 441c9c8deb..cccbb96b15 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 @@ -25,9 +25,9 @@ #include -namespace Antares::Solver +namespace Antares::Solver::LoadFiles { ModelerParameters parseModelerParameters(const std::filesystem::path& studyPath); -} // namespace Antares::Solver +} // namespace Antares::Solver::LoadFiles diff --git a/src/solver/modeler/parameters/parseModelerParameters.cpp b/src/solver/modeler/parameters/parseModelerParameters.cpp index a42050dab9..c41ca4c81a 100644 --- a/src/solver/modeler/parameters/parseModelerParameters.cpp +++ b/src/solver/modeler/parameters/parseModelerParameters.cpp @@ -27,7 +27,7 @@ #include "encoder.hxx" -namespace Antares::Solver +namespace Antares::Solver::LoadFiles { ModelerParameters parseModelerParameters(const std::filesystem::path& studyPath) { @@ -35,4 +35,4 @@ ModelerParameters parseModelerParameters(const std::filesystem::path& studyPath) YAML::Node root = YAML::Load(contents); return root.as(); } -} // namespace Antares::Solver +} // namespace Antares::Solver::LoadFiles diff --git a/src/tests/src/solver/modeler/parameters/testParametersParsing.cpp b/src/tests/src/solver/modeler/parameters/testParametersParsing.cpp index 786ca627d4..829bcfc82e 100644 --- a/src/tests/src/solver/modeler/parameters/testParametersParsing.cpp +++ b/src/tests/src/solver/modeler/parameters/testParametersParsing.cpp @@ -31,6 +31,8 @@ BOOST_AUTO_TEST_SUITE(read_modeler_parameters) +using namespace Antares::Solver::LoadFiles; + BOOST_AUTO_TEST_CASE(all_properties_set) { const auto working_tmp_dir = CREATE_TMP_DIR_BASED_ON_TEST_NAME(); @@ -44,7 +46,7 @@ solver-parameters: PRESOLVE 1 no-output: true)"; } - auto params = Antares::Solver::parseModelerParameters(working_tmp_dir); + auto params = parseModelerParameters(working_tmp_dir); BOOST_CHECK_EQUAL(params.solver, "sirius"); BOOST_CHECK_EQUAL(params.solverLogs, false); BOOST_CHECK_EQUAL(params.solverParameters, "PRESOLVE 1"); @@ -64,7 +66,7 @@ solver-parameters: PRESOLVE 1 no-output: true)"; } - auto params = Antares::Solver::parseModelerParameters(working_tmp_dir); + auto params = parseModelerParameters(working_tmp_dir); BOOST_CHECK_EQUAL(params.solver, "sirius"); BOOST_CHECK_EQUAL(params.solverLogs, false); BOOST_CHECK_EQUAL(params.solverParameters, "PRESOLVE 1");