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
59544212
Commit
59544212
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add unit test for ItemType
- cosmetic fix for itemId in 3d (face <-> edge)
parent
8d3ee3fe
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
Feature/crs
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mesh/ItemType.hpp
+5
-5
5 additions, 5 deletions
src/mesh/ItemType.hpp
tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tests/CMakeLists.txt
tests/test_ItemType.cpp
+48
-0
48 additions, 0 deletions
tests/test_ItemType.cpp
with
54 additions
and
5 deletions
src/mesh/ItemType.hpp
+
5
−
5
View file @
59544212
...
...
@@ -51,8 +51,8 @@ struct ItemId<1>
i
=
0
;
break
;
}
case
ItemType
::
face
:
case
ItemType
::
edge
:
case
ItemType
::
face
:
case
ItemType
::
node
:
{
// in 1d, faces, edges and nodes are the same
i
=
1
;
...
...
@@ -73,8 +73,8 @@ struct ItemId<2>
i
=
0
;
break
;
}
case
ItemType
::
fac
e
:
case
ItemType
::
edg
e
:
{
case
ItemType
::
edg
e
:
case
ItemType
::
fac
e
:
{
// in 2d, faces and edges are the same
i
=
1
;
break
;
...
...
@@ -98,11 +98,11 @@ struct ItemId<3>
i
=
0
;
break
;
}
case
ItemType
::
fac
e
:
{
case
ItemType
::
edg
e
:
{
i
=
1
;
break
;
}
case
ItemType
::
edg
e
:
{
case
ItemType
::
fac
e
:
{
i
=
2
;
break
;
}
...
...
This diff is collapsed.
Click to expand it.
tests/CMakeLists.txt
+
1
−
0
View file @
59544212
...
...
@@ -4,6 +4,7 @@ set(EXECUTABLE_OUTPUT_PATH ${PASTIS_BINARY_DIR})
add_executable
(
unit_tests
test_main.cpp
test_ItemType.cpp
test_PastisAssert.cpp
test_RevisionInfo.cpp
test_TinyMatrix.cpp
...
...
This diff is collapsed.
Click to expand it.
tests/test_ItemType.cpp
0 → 100644
+
48
−
0
View file @
59544212
#include
<catch.hpp>
#include
<ItemType.hpp>
TEST_CASE
(
"ItemType"
,
"[connectivity]"
)
{
ItemType
node_type
=
ItemType
::
node
;
ItemType
edge_type
=
ItemType
::
edge
;
ItemType
face_type
=
ItemType
::
face
;
ItemType
cell_type
=
ItemType
::
cell
;
SECTION
(
"checking for item type differences"
)
{
REQUIRE
(((
node_type
!=
edge_type
)
and
(
node_type
!=
face_type
)
and
(
node_type
!=
cell_type
)
and
(
edge_type
!=
face_type
)
and
(
edge_type
!=
cell_type
)
and
(
face_type
!=
cell_type
)));
}
SECTION
(
"checking for item type names"
)
{
REQUIRE
(
itemName
(
node_type
)
==
"node"
);
REQUIRE
(
itemName
(
edge_type
)
==
"edge"
);
REQUIRE
(
itemName
(
face_type
)
==
"face"
);
REQUIRE
(
itemName
(
cell_type
)
==
"cell"
);
}
SECTION
(
"checking for item ids in 1d"
)
{
REQUIRE
(
ItemId
<
1
>::
itemId
(
cell_type
)
==
0
);
REQUIRE
(
ItemId
<
1
>::
itemId
(
edge_type
)
==
1
);
REQUIRE
(
ItemId
<
1
>::
itemId
(
face_type
)
==
1
);
REQUIRE
(
ItemId
<
1
>::
itemId
(
node_type
)
==
1
);
}
SECTION
(
"checking for item ids in 2d"
)
{
REQUIRE
(
ItemId
<
2
>::
itemId
(
cell_type
)
==
0
);
REQUIRE
(
ItemId
<
2
>::
itemId
(
edge_type
)
==
1
);
REQUIRE
(
ItemId
<
2
>::
itemId
(
face_type
)
==
1
);
REQUIRE
(
ItemId
<
2
>::
itemId
(
node_type
)
==
2
);
}
SECTION
(
"checking for item ids in 3d"
)
{
REQUIRE
(
ItemId
<
3
>::
itemId
(
cell_type
)
==
0
);
REQUIRE
(
ItemId
<
3
>::
itemId
(
edge_type
)
==
1
);
REQUIRE
(
ItemId
<
3
>::
itemId
(
face_type
)
==
2
);
REQUIRE
(
ItemId
<
3
>::
itemId
(
node_type
)
==
3
);
}
}
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