diff --git a/src/utils/ReproducibleSumMPI.hpp b/src/utils/ReproducibleSumMPI.hpp index d4b80eb5d32384ba14cf49ade607cbf66fcf5632..c3b2e8ef39e4385bbc6ea949bbe3d0964c864117 100644 --- a/src/utils/ReproducibleSumMPI.hpp +++ b/src/utils/ReproducibleSumMPI.hpp @@ -7,6 +7,9 @@ #ifdef PUGS_HAS_MPI +// LCOV_EXCL_START +// This piece of code is not catchable by coverage... + template <typename RSumType> struct ReproducibleMPIReducer { @@ -22,6 +25,8 @@ struct ReproducibleMPIReducer } }; +// LCOV_EXCL_STOP + template <typename ArrayT, typename BoolArrayT> auto allReduceReproducibleSum(const ReproducibleScalarSum<ArrayT, BoolArrayT>& s) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9d2b66f1e41d8d73dfabceffe4e0b56fea2b5fb9..14727109ecb2aad2bb356a10efb0d6f9ab47760c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -130,6 +130,7 @@ add_executable (unit_tests test_QuadratureType.cpp test_RefId.cpp test_RefItemList.cpp + test_ReproducibleSumManager.cpp test_RevisionInfo.cpp test_SmallArray.cpp test_SmallMatrix.cpp diff --git a/tests/test_ReproducibleSumManager.cpp b/tests/test_ReproducibleSumManager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a406a7cd020a0980b9e928e241f487348058d852 --- /dev/null +++ b/tests/test_ReproducibleSumManager.cpp @@ -0,0 +1,22 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> + +#include <utils/ReproducibleSumManager.hpp> + +// clazy:excludeall=non-pod-global-static + +TEST_CASE("ReproducibleSumManager", "[utils]") +{ + SECTION("control settings") + { + const bool init_value = ReproducibleSumManager::reproducibleSums(); + + ReproducibleSumManager::setReproducibleSums(not init_value); + + REQUIRE(init_value == not ReproducibleSumManager::reproducibleSums()); + + ReproducibleSumManager::setReproducibleSums(init_value); + + REQUIRE(init_value == ReproducibleSumManager::reproducibleSums()); + } +}