From 85b595542bf2d346ff9c74d32bf34f081ed35afe Mon Sep 17 00:00:00 2001 From: Florian OMNES Date: Thu, 2 Jan 2025 14:23:58 +0100 Subject: [PATCH] Adapt tests --- .../short-term-storage-input-output.cpp | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) 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 0a6f355375..3300c494cf 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 @@ -929,22 +929,33 @@ BOOST_DATA_TEST_CASE(Validate_AllVariableOperatorCombinationsFromFile, BOOST_CHECK_EQUAL(result, true); // Validate loaded constraints auto& built_cluster = storageInput.storagesByIndex[0]; - BOOST_REQUIRE_EQUAL(built_cluster.additionalConstraints.size(), 1); - const auto& loadedConstraint = built_cluster.additionalConstraints[0]; - - // Check variable, operator type, and rhs values - BOOST_CHECK_EQUAL(loadedConstraint.variable, variable); - BOOST_CHECK_EQUAL(loadedConstraint.operatorType, op); - BOOST_REQUIRE_EQUAL(loadedConstraint.rhs.size(), HOURS_PER_YEAR); + if (enabled) + { + BOOST_REQUIRE_EQUAL(built_cluster.additionalConstraints.size(), 1); + } + else + { + BOOST_REQUIRE_EQUAL(built_cluster.additionalConstraints.size(), 0); + } - int i = 0; - do + if (enabled) { - BOOST_CHECK_CLOSE(loadedConstraint.rhs[i], i * 1.0, 0.001); - // Check rhs values within a tolerance + const auto& loadedConstraint = built_cluster.additionalConstraints[0]; + + // Check variable, operator type, and rhs values + BOOST_CHECK_EQUAL(loadedConstraint.variable, variable); + BOOST_CHECK_EQUAL(loadedConstraint.operatorType, op); + BOOST_REQUIRE_EQUAL(loadedConstraint.rhs.size(), HOURS_PER_YEAR); - i += HOURS_PER_YEAR / 5; - } while (i < HOURS_PER_YEAR); + int i = 0; + do + { + BOOST_CHECK_CLOSE(loadedConstraint.rhs[i], i * 1.0, 0.001); + // Check rhs values within a tolerance + + i += HOURS_PER_YEAR / 5; + } while (i < HOURS_PER_YEAR); + } } BOOST_AUTO_TEST_SUITE_END()