Skip to content
Snippets Groups Projects
Commit 7fc02d4c authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add missing tests for Messenger

parent aecb90ec
Branches
Tags
1 merge request!103Set AssertError to inherit from std::runtime_error
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_all.hpp> #include <catch2/matchers/catch_matchers_all.hpp>
#include <algebra/TinyVector.hpp>
#include <utils/Array.hpp> #include <utils/Array.hpp>
#include <utils/Messenger.hpp> #include <utils/Messenger.hpp>
...@@ -143,6 +144,14 @@ TEST_CASE("Messenger", "[mpi]") ...@@ -143,6 +144,14 @@ TEST_CASE("Messenger", "[mpi]")
const bool or_value_2 = parallel::allReduceOr(parallel::rank() > 0); const bool or_value_2 = parallel::allReduceOr(parallel::rank() > 0);
REQUIRE(or_value_2 == (parallel::size() > 1)); REQUIRE(or_value_2 == (parallel::size() > 1));
const size_t sum_value = parallel::allReduceSum(parallel::rank() + 1);
REQUIRE(sum_value == parallel::size() * (parallel::size() + 1) / 2);
const TinyVector<2, size_t> sum_tiny_vector =
parallel::allReduceSum(TinyVector<2, size_t>(parallel::rank() + 1, 1));
REQUIRE(
(sum_tiny_vector == TinyVector<2, size_t>{parallel::size() * (parallel::size() + 1) / 2, parallel::size()}));
} }
SECTION("all to all") SECTION("all to all")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment