-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...ver/modeler/parameters/include/antares/solver/modeler/parameters/parseModelerParameters.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(api) | ||
add_subdirectory(parameters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Zip writer | ||
add_executable(parse-parameters testParametersParsing.cpp) | ||
|
||
target_link_libraries(parse-parameters | ||
PRIVATE | ||
Boost::unit_test_framework | ||
modeler-parameters | ||
test_utils_unit | ||
) | ||
|
||
set_target_properties(parse-parameters PROPERTIES FOLDER Unit-tests/test-writer) | ||
|
||
add_test(NAME parse-parameters COMMAND parse-parameters) | ||
set_tests_properties(parse-parameters PROPERTIES LABELS unit) |
54 changes: 54 additions & 0 deletions
54
src/tests/src/solver/modeler/parameters/testParametersParsing.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2007-2024, RTE (https://www.rte-france.com) | ||
* See AUTHORS.txt | ||
* SPDX-License-Identifier: MPL-2.0 | ||
* This file is part of Antares-Simulator, | ||
* Adequacy and Performance assessment for interconnected energy networks. | ||
* | ||
* Antares_Simulator is free software: you can redistribute it and/or modify | ||
* it under the terms of the Mozilla Public Licence 2.0 as published by | ||
* the Mozilla Foundation, either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Antares_Simulator is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* Mozilla Public Licence 2.0 for more details. | ||
* | ||
* You should have received a copy of the Mozilla Public Licence 2.0 | ||
* along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#define WIN32_LEAN_AND_MEAN | ||
|
||
#include <fstream> | ||
#define BOOST_TEST_MODULE parse modeler parameters | ||
|
||
#include <boost/test/unit_test.hpp> | ||
|
||
#include <antares/solver/modeler/parameters/parseModelerParameters.h> | ||
|
||
#include "files-system.h" | ||
|
||
BOOST_AUTO_TEST_SUITE(read_modeler_parameters) | ||
|
||
BOOST_AUTO_TEST_CASE(simple) | ||
{ | ||
const auto working_tmp_dir = CREATE_TMP_DIR_BASED_ON_TEST_NAME(); | ||
const auto fileP = working_tmp_dir / "parameters.yaml"; | ||
{ | ||
std::ofstream param(fileP); | ||
param << R"( | ||
solver: sirius | ||
solver-logs: false | ||
solver-parameters: PRESOLVE 1 | ||
no-output: true)"; | ||
} | ||
|
||
auto params = Antares::Solver::parseModelerParameters(fileP); | ||
BOOST_CHECK_EQUAL(params.solver, "sirius"); | ||
BOOST_CHECK_EQUAL(params.solverLogs, false); | ||
BOOST_CHECK_EQUAL(params.solverParameters, "PRESOLVE 1"); | ||
BOOST_CHECK_EQUAL(params.noOutput, true); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |