From 480c30fa21da4da4d050591829a0e10d8e3f9b3c Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Tue, 31 Dec 2024 12:27:37 +0100 Subject: [PATCH] rename loadconstrintfrominifile --- src/libs/antares/study/area/list.cpp | 2 +- .../parts/short-term-storage/container.h | 2 +- .../parts/short-term-storage/container.cpp | 2 +- .../short-term-storage-input-output.cpp | 40 +++++++++---------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/libs/antares/study/area/list.cpp b/src/libs/antares/study/area/list.cpp index eee3eff996..c91ecc1e38 100644 --- a/src/libs/antares/study/area/list.cpp +++ b/src/libs/antares/study/area/list.cpp @@ -1201,7 +1201,7 @@ bool AreaList::loadFromFolder(const StudyLoadOptions& options) && ret; const auto constraints_folder = stsFolder / "constraints" / area->id.c_str(); - ret = area->shortTermStorage.LoadConstraintsFromIniFile(constraints_folder) && ret; + ret = area->shortTermStorage.loadAdditionalConstraints(constraints_folder) && ret; } } else diff --git a/src/libs/antares/study/include/antares/study/parts/short-term-storage/container.h b/src/libs/antares/study/include/antares/study/parts/short-term-storage/container.h index 65dc8145bc..b53abc48f0 100644 --- a/src/libs/antares/study/include/antares/study/parts/short-term-storage/container.h +++ b/src/libs/antares/study/include/antares/study/parts/short-term-storage/container.h @@ -41,7 +41,7 @@ class STStorageInput /// Number of enabled ST storages, ignoring disabled ST storages std::size_t count() const; - bool LoadConstraintsFromIniFile(const std::filesystem::path& filePath); + bool loadAdditionalConstraints(const std::filesystem::path& filePath); /// erase disabled cluster from the vector uint removeDisabledClusters(); diff --git a/src/libs/antares/study/parts/short-term-storage/container.cpp b/src/libs/antares/study/parts/short-term-storage/container.cpp index fc6623bf29..67ad445efd 100644 --- a/src/libs/antares/study/parts/short-term-storage/container.cpp +++ b/src/libs/antares/study/parts/short-term-storage/container.cpp @@ -115,7 +115,7 @@ static void loadHours(const std::string& hoursStr, AdditionalConstraints& additi } } -bool STStorageInput::LoadConstraintsFromIniFile(const fs::path& parent_path) +bool STStorageInput::loadAdditionalConstraints(const fs::path& parent_path) { IniFile ini; const auto pathIni = parent_path / "additional-constraints.ini"; diff --git a/src/tests/src/libs/antares/study/short-term-storage-input/short-term-storage-input-output.cpp b/src/tests/src/libs/antares/study/short-term-storage-input/short-term-storage-input-output.cpp index 9c86e0b972..0de38df1ab 100644 --- a/src/tests/src/libs/antares/study/short-term-storage-input/short-term-storage-input-output.cpp +++ b/src/tests/src/libs/antares/study/short-term-storage-input/short-term-storage-input-output.cpp @@ -543,7 +543,7 @@ BOOST_AUTO_TEST_CASE(Validate_ValidConstraints) BOOST_CHECK(error_msg.empty()); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_ValidFile) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_ValidFile) { std::filesystem::path testPath = getFolder() / "test_data"; std::filesystem::create_directory(testPath); @@ -561,7 +561,7 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_ValidFile) cluster.id = "cluster1"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, true); BOOST_CHECK_EQUAL(storageInput.storagesByIndex[0].additional_constraints.size(), 1); @@ -571,7 +571,7 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_ValidFile) std::filesystem::remove_all(testPath); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_InvalidHours) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_InvalidHours) { std::filesystem::path testPath = getFolder() / "test_data"; std::filesystem::create_directory(testPath); @@ -589,13 +589,13 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_InvalidHours) cluster.id = "ClusterA"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, false); std::filesystem::remove_all(testPath); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_ValidHoursFormats) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_ValidHoursFormats) { std::filesystem::path testPath = getFolder() / "test_data"; std::filesystem::create_directory(testPath); @@ -613,20 +613,20 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_ValidHoursFormats) cluster.id = "cluster1"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, true); std::filesystem::remove_all(testPath); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_MissingFile) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_MissingFile) { ShortTermStorage::STStorageInput storageInput; - bool result = storageInput.LoadConstraintsFromIniFile("nonexistent_path"); + bool result = storageInput.loadAdditionalConstraints("nonexistent_path"); BOOST_CHECK_EQUAL(result, true); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_InvalidConstraint) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_InvalidConstraint) { std::filesystem::path testPath = getFolder() / "test_data"; std::filesystem::create_directory(testPath); @@ -644,13 +644,13 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_InvalidConstraint) cluster.id = "cluster1"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, false); std::filesystem::remove_all(testPath); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_ValidRhs) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_ValidRhs) { std::filesystem::path testPath = getFolder() / "test_data"; std::filesystem::create_directory(testPath); @@ -675,7 +675,7 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_ValidRhs) cluster.id = "cluster1"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, true); BOOST_CHECK_EQUAL(storageInput.storagesByIndex[0].additional_constraints[0].rhs.size(), @@ -718,7 +718,7 @@ BOOST_AUTO_TEST_CASE(Load2ConstraintsFromIniFile) cluster.id = "cluster1"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, true); BOOST_CHECK_EQUAL(storageInput.storagesByIndex[0].additional_constraints.size(), 2); @@ -748,7 +748,7 @@ BOOST_AUTO_TEST_CASE(Load2ConstraintsFromIniFile) std::filesystem::remove_all(testPath); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_MissingRhsFile) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_MissingRhsFile) { std::filesystem::path testPath = getFolder() / "test_data"; std::filesystem::create_directory(testPath); @@ -766,7 +766,7 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_MissingRhsFile) cluster.id = "cluster1"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, true); BOOST_CHECK_EQUAL(storageInput.storagesByIndex[0].additional_constraints[0].rhs.size(), @@ -776,7 +776,7 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_MissingRhsFile) std::filesystem::remove_all(testPath); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_MalformedRhsFile) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_MalformedRhsFile) { std::filesystem::path testPath = getFolder() / "test_data"; std::filesystem::create_directory(testPath); @@ -798,13 +798,13 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_MalformedRhsFile) cluster.id = "ClusterA"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, false); std::filesystem::remove_all(testPath); } -BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_IncompleteRhsFile) +BOOST_AUTO_TEST_CASE(loadAdditionalConstraints_IncompleteRhsFile) { std::filesystem::path testPath = getFolder() / "test_data"; std::filesystem::create_directory(testPath); @@ -829,7 +829,7 @@ BOOST_AUTO_TEST_CASE(LoadConstraintsFromIniFile_IncompleteRhsFile) cluster.id = "ClusterA"; storageInput.storagesByIndex.push_back(cluster); - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); BOOST_CHECK_EQUAL(result, false); std::filesystem::remove_all(testPath); @@ -895,7 +895,7 @@ BOOST_DATA_TEST_CASE(Validate_AllVariableOperatorCombinationsFromFile, storageInput.storagesByIndex.push_back(cluster); // Load constraints from the `.ini` file - bool result = storageInput.LoadConstraintsFromIniFile(testPath); + bool result = storageInput.loadAdditionalConstraints(testPath); // Assertions BOOST_CHECK_EQUAL(result, true);