Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
2fbcc0a5
Commit
2fbcc0a5
authored
7 months ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for CommunicatorManager
parent
91fd65a2
No related branches found
No related tags found
1 merge request
!199
Integrate checkpointing
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/utils/CommunicatorManager.hpp
+2
-0
2 additions, 0 deletions
src/utils/CommunicatorManager.hpp
tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tests/CMakeLists.txt
tests/test_CommunicatorManager.cpp
+29
-0
29 additions, 0 deletions
tests/test_CommunicatorManager.cpp
with
32 additions
and
0 deletions
src/utils/CommunicatorManager.hpp
+
2
−
0
View file @
2fbcc0a5
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
tests/CMakeLists.txt
+
1
−
0
View file @
2fbcc0a5
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
tests/test_CommunicatorManager.cpp
0 → 100644
+
29
−
0
View file @
2fbcc0a5
#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
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment