Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Core Modules
dune-common
Commits
1fd33bdb
Commit
1fd33bdb
authored
2 years ago
by
Simon Praetorius
Browse files
Options
Downloads
Patches
Plain Diff
Add test for non-copyable and non-moveable types
parent
61531e64
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1158
Fillin missing functionality in ReservedVector and make it constexpr
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/common/test/reservedvectortest.cc
+34
-1
34 additions, 1 deletion
dune/common/test/reservedvectortest.cc
with
34 additions
and
1 deletion
dune/common/test/reservedvectortest.cc
+
34
−
1
View file @
1fd33bdb
...
...
@@ -34,6 +34,24 @@ struct A
int
size_
=
0
;
};
struct
NoCopy
{
NoCopy
()
=
default
;
NoCopy
(
const
NoCopy
&
)
=
delete
;
NoCopy
(
NoCopy
&&
)
=
default
;
NoCopy
&
operator
=
(
const
NoCopy
&
)
=
delete
;
NoCopy
&
operator
=
(
NoCopy
&&
)
=
default
;
};
struct
NoMove
{
NoMove
()
=
default
;
NoMove
(
const
NoMove
&
)
=
default
;
NoMove
(
NoMove
&&
)
=
delete
;
NoMove
&
operator
=
(
const
NoMove
&
)
=
default
;
NoMove
&
operator
=
(
NoMove
&&
)
=
delete
;
};
int
main
()
{
Dune
::
TestSuite
test
;
// check that make_array works
...
...
@@ -103,7 +121,7 @@ int main() {
test
.
check
(
*
it
==
i
++
);
}
{
// check non-
fundament
al types
{
// check non-
trivi
al types
Dune
::
ReservedVector
<
A
,
8
>
rvA
;
rvA
.
push_back
(
A
(
5
));
rvA
.
emplace_back
(
A
(
5
));
...
...
@@ -111,6 +129,21 @@ int main() {
test
.
check
(
rvA
.
size
()
==
3
);
}
{
// check non-copyable types
Dune
::
ReservedVector
<
NoCopy
,
8
>
rv
;
rv
.
push_back
(
NoCopy
{});
rv
.
emplace_back
();
test
.
check
(
rv
.
size
()
==
2
);
}
{
// check non-movable types
Dune
::
ReservedVector
<
NoMove
,
8
>
rv
;
NoMove
x
;
rv
.
push_back
(
x
);
rv
.
emplace_back
();
test
.
check
(
rv
.
size
()
==
2
);
}
{
// check constexpr
constexpr
Dune
::
ReservedVector
<
unsigned
int
,
8
>
crv
{
3
,
2
,
1
};
static_assert
(
crv
.
size
()
==
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