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

Add tests for CommunicatorManager

parent 91fd65a2
No related branches found
No related tags found
1 merge request!199Integrate checkpointing
...@@ -8,6 +8,8 @@ class CommunicatorManager ...@@ -8,6 +8,8 @@ class CommunicatorManager
private: private:
static std::optional<int> s_split_color; static std::optional<int> s_split_color;
friend void resetCommunicationManagerForTests();
public: public:
static bool hasSplitColor(); static bool hasSplitColor();
static int splitColor(); static int splitColor();
......
...@@ -61,6 +61,7 @@ add_executable (unit_tests ...@@ -61,6 +61,7 @@ add_executable (unit_tests
test_CastArray.cpp test_CastArray.cpp
test_CellIntegrator.cpp test_CellIntegrator.cpp
test_CellType.cpp test_CellType.cpp
test_CommunicatorManager.cpp
test_ConsoleManager.cpp test_ConsoleManager.cpp
test_CG.cpp test_CG.cpp
test_ConcatExpressionProcessor.cpp test_ConcatExpressionProcessor.cpp
......
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_all.hpp>
#include <utils/CommunicatorManager.hpp>
// clazy:excludeall=non-pod-global-static
inline void
resetCommunicationManagerForTests()
{
CommunicatorManager::s_split_color.reset();
}
TEST_CASE("CommunicatorManager", "[utils]")
{
resetCommunicationManagerForTests();
REQUIRE(not CommunicatorManager::hasSplitColor());
#ifndef NDEBUG
REQUIRE_THROWS_WITH(CommunicatorManager::splitColor(), "split color has not been defined");
#endif // NDEBUG
REQUIRE_NOTHROW(CommunicatorManager::setSplitColor(2));
REQUIRE(CommunicatorManager::splitColor() == 2);
#ifndef NDEBUG
REQUIRE_THROWS_WITH(CommunicatorManager::setSplitColor(2), "split color has already been defined");
#endif // NDEBUG
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment