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
ecbe1b99
Commit
ecbe1b99
authored
1 year ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add few tests for MeshVariant
parent
3368ffff
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!182
Get rid of IMesh (mesh interface class) and use MeshVariant instead
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tests/CMakeLists.txt
tests/test_MeshVariant.cpp
+98
-0
98 additions, 0 deletions
tests/test_MeshVariant.cpp
with
99 additions
and
0 deletions
tests/CMakeLists.txt
+
1
−
0
View file @
ecbe1b99
...
...
@@ -197,6 +197,7 @@ add_executable (mpi_unit_tests
test_MeshLineNodeBoundary.cpp
test_MeshNodeBoundary.cpp
test_MeshNodeInterface.cpp
test_MeshVariant.cpp
test_Messenger.cpp
test_OFStream.cpp
test_ParallelChecker_read.cpp
...
...
This diff is collapsed.
Click to expand it.
tests/test_MeshVariant.cpp
0 → 100644
+
98
−
0
View file @
ecbe1b99
#include
<catch2/catch_test_macros.hpp>
#include
<catch2/matchers/catch_matchers_all.hpp>
#include
<MeshDataBaseForTests.hpp>
#include
<mesh/Mesh.hpp>
#include
<mesh/MeshVariant.hpp>
// clazy:excludeall=non-pod-global-static
TEST_CASE
(
"MeshVariant"
,
"[mesh]"
)
{
SECTION
(
"1D"
)
{
auto
mesh_v
=
MeshDataBaseForTests
::
get
().
unordered1DMesh
();
auto
mesh
=
mesh_v
->
get
<
Mesh
<
1
>>
();
const
std
::
string
error_msg
=
R"(error: invalid mesh type type
- required Mesh<3ul>
- contains Mesh<1ul>)"
;
REQUIRE_THROWS_WITH
(
mesh_v
->
get
<
Mesh
<
3
>>
(),
error_msg
);
REQUIRE
(
mesh
->
id
()
==
mesh_v
->
id
());
REQUIRE
(
mesh
->
numberOfCells
()
==
mesh_v
->
numberOfCells
());
REQUIRE
(
mesh
->
numberOfFaces
()
==
mesh_v
->
numberOfFaces
());
REQUIRE
(
mesh
->
numberOfEdges
()
==
mesh_v
->
numberOfEdges
());
REQUIRE
(
mesh
->
numberOfNodes
()
==
mesh_v
->
numberOfNodes
());
{
std
::
ostringstream
os_v
;
os_v
<<
*
mesh_v
;
std
::
ostringstream
os
;
os
<<
*
mesh
;
REQUIRE
(
os_v
.
str
()
==
os
.
str
());
}
}
SECTION
(
"2D"
)
{
auto
mesh_v
=
MeshDataBaseForTests
::
get
().
hybrid2DMesh
();
auto
mesh
=
mesh_v
->
get
<
Mesh
<
2
>>
();
const
std
::
string
error_msg
=
R"(error: invalid mesh type type
- required Mesh<1ul>
- contains Mesh<2ul>)"
;
REQUIRE_THROWS_WITH
(
mesh_v
->
get
<
Mesh
<
1
>>
(),
error_msg
);
REQUIRE
(
mesh
->
id
()
==
mesh_v
->
id
());
REQUIRE
(
mesh
->
numberOfCells
()
==
mesh_v
->
numberOfCells
());
REQUIRE
(
mesh
->
numberOfFaces
()
==
mesh_v
->
numberOfFaces
());
REQUIRE
(
mesh
->
numberOfEdges
()
==
mesh_v
->
numberOfEdges
());
REQUIRE
(
mesh
->
numberOfNodes
()
==
mesh_v
->
numberOfNodes
());
{
std
::
ostringstream
os_v
;
os_v
<<
*
mesh_v
;
std
::
ostringstream
os
;
os
<<
*
mesh
;
REQUIRE
(
os_v
.
str
()
==
os
.
str
());
}
}
SECTION
(
"3D"
)
{
auto
mesh_v
=
MeshDataBaseForTests
::
get
().
hybrid3DMesh
();
auto
mesh
=
mesh_v
->
get
<
Mesh
<
3
>>
();
const
std
::
string
error_msg
=
R"(error: invalid mesh type type
- required Mesh<2ul>
- contains Mesh<3ul>)"
;
REQUIRE_THROWS_WITH
(
mesh_v
->
get
<
Mesh
<
2
>>
(),
error_msg
);
REQUIRE
(
mesh
->
id
()
==
mesh_v
->
id
());
REQUIRE
(
mesh
->
numberOfCells
()
==
mesh_v
->
numberOfCells
());
REQUIRE
(
mesh
->
numberOfFaces
()
==
mesh_v
->
numberOfFaces
());
REQUIRE
(
mesh
->
numberOfEdges
()
==
mesh_v
->
numberOfEdges
());
REQUIRE
(
mesh
->
numberOfNodes
()
==
mesh_v
->
numberOfNodes
());
{
std
::
ostringstream
os_v
;
os_v
<<
*
mesh_v
;
std
::
ostringstream
os
;
os
<<
*
mesh
;
REQUIRE
(
os_v
.
str
()
==
os
.
str
());
}
}
}
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