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
40a3c74d
Commit
40a3c74d
authored
4 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add missing tests for AggregateDataVariant
parent
978e68a4
No related branches found
No related tags found
1 merge request
!54
Feature/language coverage
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/language/utils/DataVariant.hpp
+4
-2
4 additions, 2 deletions
src/language/utils/DataVariant.hpp
tests/test_DataVariant.cpp
+36
-1
36 additions, 1 deletion
tests/test_DataVariant.cpp
with
40 additions
and
3 deletions
src/language/utils/DataVariant.hpp
+
4
−
2
View file @
40a3c74d
...
...
@@ -71,14 +71,16 @@ class AggregateDataVariant // LCOV_EXCL_LINE
}
PUGS_INLINE
DataVariant
&
operator
[](
size_t
i
)
DataVariant
&
operator
[](
size_t
i
)
{
Assert
(
i
<
m_data_vector
.
size
());
return
m_data_vector
[
i
];
}
PUGS_INLINE
const
DataVariant
&
operator
[](
size_t
i
)
const
const
DataVariant
&
operator
[](
size_t
i
)
const
{
Assert
(
i
<
m_data_vector
.
size
());
return
m_data_vector
[
i
];
...
...
This diff is collapsed.
Click to expand it.
tests/test_DataVariant.cpp
+
36
−
1
View file @
40a3c74d
...
...
@@ -34,7 +34,7 @@ TEST_CASE("DataVariant", "[language]")
REQUIRE
(
std
::
get
<
std
::
vector
<
double
>>
(
aggregate
[
2
])
==
std
::
vector
<
double
>
{
1
,
2.7
});
}
SECTION
(
"
C
opy"
)
SECTION
(
"
c
opy"
)
{
AggregateDataVariant
aggregate_copy
{
aggregate
};
...
...
@@ -48,5 +48,40 @@ TEST_CASE("DataVariant", "[language]")
REQUIRE
(
std
::
get
<
int64_t
>
(
aggregate
[
1
])
==
std
::
get
<
int64_t
>
(
aggregate_copy
[
1
]));
REQUIRE
(
std
::
get
<
std
::
vector
<
double
>>
(
aggregate
[
2
])
==
std
::
get
<
std
::
vector
<
double
>>
(
aggregate_copy
[
2
]));
}
SECTION
(
"affectation"
)
{
AggregateDataVariant
aggregate_copy
;
aggregate_copy
=
aggregate
;
REQUIRE
(
aggregate
.
size
()
==
aggregate_copy
.
size
());
for
(
size_t
i
=
0
;
i
<
aggregate
.
size
();
++
i
)
{
REQUIRE
(
aggregate
[
i
].
index
()
==
aggregate_copy
[
i
].
index
());
}
REQUIRE
(
std
::
get
<
double
>
(
aggregate
[
0
])
==
std
::
get
<
double
>
(
aggregate_copy
[
0
]));
REQUIRE
(
std
::
get
<
int64_t
>
(
aggregate
[
1
])
==
std
::
get
<
int64_t
>
(
aggregate_copy
[
1
]));
REQUIRE
(
std
::
get
<
std
::
vector
<
double
>>
(
aggregate
[
2
])
==
std
::
get
<
std
::
vector
<
double
>>
(
aggregate_copy
[
2
]));
}
SECTION
(
"move affectation"
)
{
AggregateDataVariant
aggregate_move_copy
;
{
AggregateDataVariant
aggregate_copy
{
aggregate
};
aggregate_move_copy
=
std
::
move
(
aggregate_copy
);
}
REQUIRE
(
aggregate
.
size
()
==
aggregate_move_copy
.
size
());
for
(
size_t
i
=
0
;
i
<
aggregate
.
size
();
++
i
)
{
REQUIRE
(
aggregate
[
i
].
index
()
==
aggregate_move_copy
[
i
].
index
());
}
REQUIRE
(
std
::
get
<
double
>
(
aggregate
[
0
])
==
std
::
get
<
double
>
(
aggregate_move_copy
[
0
]));
REQUIRE
(
std
::
get
<
int64_t
>
(
aggregate
[
1
])
==
std
::
get
<
int64_t
>
(
aggregate_move_copy
[
1
]));
REQUIRE
(
std
::
get
<
std
::
vector
<
double
>>
(
aggregate
[
2
])
==
std
::
get
<
std
::
vector
<
double
>>
(
aggregate_move_copy
[
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