diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index d60217fc83..12290fa032 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -148,6 +148,38 @@ jobs: batch-name: adequacy-patch-CSR os: ${{ matrix.os }} + - name: Run tests introduced in 8.6.0 + continue-on-error: true + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v860 + os: ${{ env.os }} + + - name: Run tests introduced in 8.7.0 + continue-on-error: true + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v870 + os: ${{ env.os }} + + - name: Run tests introduced in 9.1.0 + continue-on-error: true + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v910 + os: ${{ env.os }} + + - name: Run tests introduced in 9.2.0 + continue-on-error: true + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v920 + os: ${{ env.os }} + - name: Collect coverage into one XML report run: | gcovr --sonarqube --output coverage.xml diff --git a/simtest.json b/simtest.json index 60f2219bb7..e5346ead1e 100644 --- a/simtest.json +++ b/simtest.json @@ -1,3 +1,3 @@ { - "version": "v9.2.0i" + "version": "v9.2.0k" } diff --git a/src/solver/variable/surveyresults/surveyresults.cpp b/src/solver/variable/surveyresults/surveyresults.cpp index cb88d34003..552e205d61 100644 --- a/src/solver/variable/surveyresults/surveyresults.cpp +++ b/src/solver/variable/surveyresults/surveyresults.cpp @@ -558,7 +558,11 @@ SurveyResults::SurveyResults(const Data::Study& s, const Yuni::String& o, IResul digestNonApplicableStatus = new bool*[digestSize]; for (uint i = 0; i < digestSize; i++) { - digestNonApplicableStatus[i] = new bool[maxVariables]{false}; + digestNonApplicableStatus[i] = new bool[maxVariables]; + for (uint var = 0; var != maxVariables; ++var) + { + digestNonApplicableStatus[i][var] = false; + } } } diff --git a/src/tests/src/solver/variable/CMakeLists.txt b/src/tests/src/solver/variable/CMakeLists.txt index f06cb7ee2e..d068bea6dc 100644 --- a/src/tests/src/solver/variable/CMakeLists.txt +++ b/src/tests/src/solver/variable/CMakeLists.txt @@ -3,3 +3,9 @@ include(${CMAKE_SOURCE_DIR}/tests/macros.cmake) add_boost_test(test-intermediate SRC test_intermediate.cpp LIBS antares-solver-variable) + +add_boost_test(test-surveyresults + SRC test_surveyresults.cpp + LIBS + antares-solver-variable + result_writer) diff --git a/src/tests/src/solver/variable/test_surveyresults.cpp b/src/tests/src/solver/variable/test_surveyresults.cpp new file mode 100644 index 0000000000..e6c5c78edc --- /dev/null +++ b/src/tests/src/solver/variable/test_surveyresults.cpp @@ -0,0 +1,56 @@ +/* + * 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 . + */ +#define BOOST_TEST_MODULE "test time series" + +#define WIN32_LEAN_AND_MEAN + +#include + +#include "antares/solver/variable/surveyresults.h" +#include "antares/writer/in_memory_writer.h" + +using namespace Antares::Solver::Variable; + +struct StudyFixture +{ + StudyFixture(): + study(std::make_unique()) + { + study->parameters.simulationDays.first = 0; + study->parameters.simulationDays.end = 7; + study->initializeRuntimeInfos(); + } + + std::unique_ptr study; +}; + +BOOST_AUTO_TEST_SUITE(surveyresults) + +BOOST_FIXTURE_TEST_CASE(no_variable_constructor_does_not_throw, StudyFixture) +{ + Benchmarking::DurationCollector durationCollector; + Antares::Solver::InMemoryWriter writer(durationCollector); + // At least one area was required to trigger a std::bad_alloc throw + Antares::Data::addAreaToListOfAreas(study->areas, "dummyArea"); + BOOST_CHECK_NO_THROW(SurveyResults survey(*study, "out", writer);); +} + +BOOST_AUTO_TEST_SUITE_END()