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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
54f2df2e
Commit
54f2df2e
authored
3 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add missing tests for DualMeshManager
parent
08be4530
No related branches found
No related tags found
1 merge request
!128
Feature/unit tests
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_DualMeshManager.cpp
+116
-56
116 additions, 56 deletions
tests/test_DualMeshManager.cpp
with
116 additions
and
56 deletions
tests/test_DualMeshManager.cpp
+
116
−
56
View file @
54f2df2e
...
@@ -10,6 +10,24 @@
...
@@ -10,6 +10,24 @@
// clazy:excludeall=non-pod-global-static
// clazy:excludeall=non-pod-global-static
TEST_CASE
(
"DualMeshManager"
,
"[mesh]"
)
TEST_CASE
(
"DualMeshManager"
,
"[mesh]"
)
{
SECTION
(
"same 1D dual connectivities "
)
{
using
ConnectivityType
=
Connectivity
<
1
>
;
using
MeshType
=
Mesh
<
ConnectivityType
>
;
std
::
shared_ptr
<
const
MeshType
>
mesh
=
MeshDataBaseForTests
::
get
().
unordered1DMesh
();
std
::
shared_ptr
p_diamond_dual_mesh
=
DualMeshManager
::
instance
().
getDiamondDualMesh
(
*
mesh
);
std
::
shared_ptr
p_median_dual_mesh
=
DualMeshManager
::
instance
().
getMedianDualMesh
(
*
mesh
);
std
::
shared_ptr
p_dual1d_mesh
=
DualMeshManager
::
instance
().
getDual1DMesh
(
*
mesh
);
// In 1d all these dual meshes are the same
REQUIRE
(
p_dual1d_mesh
.
get
()
==
p_diamond_dual_mesh
.
get
());
REQUIRE
(
p_dual1d_mesh
.
get
()
==
p_median_dual_mesh
.
get
());
}
SECTION
(
"2D"
)
{
{
using
ConnectivityType
=
Connectivity
<
2
>
;
using
ConnectivityType
=
Connectivity
<
2
>
;
using
MeshType
=
Mesh
<
ConnectivityType
>
;
using
MeshType
=
Mesh
<
ConnectivityType
>
;
...
@@ -97,3 +115,45 @@ TEST_CASE("DualMeshManager", "[mesh]")
...
@@ -97,3 +115,45 @@ TEST_CASE("DualMeshManager", "[mesh]")
REQUIRE
(
p_diamond_dual_mesh
.
use_count
()
==
diamond_ref_counter
-
1
);
REQUIRE
(
p_diamond_dual_mesh
.
use_count
()
==
diamond_ref_counter
-
1
);
}
}
}
}
SECTION
(
"3D"
)
{
using
ConnectivityType
=
Connectivity
<
3
>
;
using
MeshType
=
Mesh
<
ConnectivityType
>
;
std
::
shared_ptr
<
const
MeshType
>
mesh
=
MeshDataBaseForTests
::
get
().
hybrid3DMesh
();
SECTION
(
"diamond dual mesh access"
)
{
std
::
shared_ptr
p_diamond_dual_mesh
=
DualMeshManager
::
instance
().
getDiamondDualMesh
(
*
mesh
);
const
auto
ref_counter
=
p_diamond_dual_mesh
.
use_count
();
{
std
::
shared_ptr
p_diamond_dual_mesh2
=
DualMeshManager
::
instance
().
getDiamondDualMesh
(
*
mesh
);
REQUIRE
(
p_diamond_dual_mesh
==
p_diamond_dual_mesh2
);
REQUIRE
(
p_diamond_dual_mesh
.
use_count
()
==
ref_counter
+
1
);
}
REQUIRE
(
p_diamond_dual_mesh
.
use_count
()
==
ref_counter
);
DualMeshManager
::
instance
().
deleteMesh
(
mesh
.
get
());
REQUIRE
(
p_diamond_dual_mesh
.
use_count
()
==
ref_counter
-
1
);
// Can delete mesh from the list again. This means that no
// dual mesh associated with it is managed.
REQUIRE_NOTHROW
(
DualMeshManager
::
instance
().
deleteMesh
(
mesh
.
get
()));
REQUIRE
(
p_diamond_dual_mesh
.
use_count
()
==
ref_counter
-
1
);
// A new dual mesh is built
std
::
shared_ptr
p_diamond_dual_mesh_rebuilt
=
DualMeshManager
::
instance
().
getDiamondDualMesh
(
*
mesh
);
REQUIRE
(
p_diamond_dual_mesh
!=
p_diamond_dual_mesh_rebuilt
);
REQUIRE
(
p_diamond_dual_mesh
.
get
()
!=
p_diamond_dual_mesh_rebuilt
.
get
());
// Exactly two references to the dual mesh. One here and
// one in the manager.
REQUIRE
(
p_diamond_dual_mesh_rebuilt
.
use_count
()
==
2
);
}
}
}
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