Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
ChimeraTK Mirror
ApplicationCore
Commits
35759686
Commit
35759686
authored
7 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
added dedicated tests for findTag and excludeTag
parent
5d1ccc6b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/executables_src/testModules.cc
+119
-0
119 additions, 0 deletions
tests/executables_src/testModules.cc
with
119 additions
and
0 deletions
tests/executables_src/testModules.cc
+
119
−
0
View file @
35759686
...
...
@@ -593,6 +593,125 @@ BOOST_AUTO_TEST_CASE( testApplicationModuleSubscriptOp ) {
}
/*********************************************************************************************************************/
/* test finding variables by tag */
BOOST_AUTO_TEST_CASE
(
testFindTags
)
{
std
::
cout
<<
"*********************************************************************************************************************"
<<
std
::
endl
;
std
::
cout
<<
"==> testFindTags"
<<
std
::
endl
;
OneModuleApp
app
;
// search for tag "A"
{
ctk
::
VirtualModule
tagA
=
app
.
testModule
.
findTag
(
"A"
);
// check direct variables
{
std
::
list
<
ctk
::
VariableNetworkNode
>
&
list
=
tagA
.
getAccessorList
();
BOOST_CHECK
(
list
.
size
()
==
2
);
size_t
foundSomeInput
=
0
;
size_t
foundSomeOutput
=
0
;
for
(
auto
var
:
list
)
{
if
(
var
==
app
.
testModule
.
someInput
)
foundSomeInput
++
;
if
(
var
==
app
.
testModule
.
someOutput
)
foundSomeOutput
++
;
}
BOOST_CHECK
(
foundSomeInput
==
1
);
BOOST_CHECK
(
foundSomeOutput
==
1
);
}
// check number of submodules
{
std
::
list
<
ctk
::
Module
*>
list
=
tagA
.
getSubmoduleList
();
BOOST_CHECK
(
list
.
size
()
==
1
);
}
// check content of submodule
{
std
::
list
<
ctk
::
VariableNetworkNode
>
list
=
tagA
[
"someGroup"
].
getAccessorList
();
BOOST_CHECK
(
list
.
size
()
==
2
);
size_t
foundInGroup
=
0
;
size_t
foundAlsoInGroup
=
0
;
for
(
auto
var
:
list
)
{
if
(
var
==
app
.
testModule
.
someGroup
.
inGroup
)
foundInGroup
++
;
if
(
var
==
app
.
testModule
.
someGroup
.
alsoInGroup
)
foundAlsoInGroup
++
;
}
BOOST_CHECK
(
foundInGroup
==
1
);
BOOST_CHECK
(
foundAlsoInGroup
==
1
);
}
}
// search for tag "D"
{
ctk
::
VirtualModule
tagD
=
app
.
testModule
.
findTag
(
"D"
);
// check direct variables
{
std
::
list
<
ctk
::
VariableNetworkNode
>
&
list
=
tagD
.
getAccessorList
();
BOOST_CHECK
(
list
.
size
()
==
0
);
}
// check number of submodules
{
std
::
list
<
ctk
::
Module
*>
list
=
tagD
.
getSubmoduleList
();
BOOST_CHECK
(
list
.
size
()
==
2
);
}
// check content of submodule "someGroup"
{
std
::
list
<
ctk
::
VariableNetworkNode
>
list
=
tagD
[
"someGroup"
].
getAccessorList
();
BOOST_CHECK
(
list
.
size
()
==
1
);
size_t
foundAlsoInGroup
=
0
;
for
(
auto
var
:
list
)
{
if
(
var
==
app
.
testModule
.
someGroup
.
alsoInGroup
)
foundAlsoInGroup
++
;
}
BOOST_CHECK
(
foundAlsoInGroup
==
1
);
}
// check content of submodule "anotherName"
{
std
::
list
<
ctk
::
VariableNetworkNode
>
list
=
tagD
[
"anotherName"
].
getAccessorList
();
BOOST_CHECK
(
list
.
size
()
==
1
);
size_t
foundFoo
=
0
;
for
(
auto
var
:
list
)
{
if
(
var
==
app
.
testModule
.
anotherGroup
.
foo
)
foundFoo
++
;
}
BOOST_CHECK
(
foundFoo
==
1
);
}
}
// search for tag "D", exclude tag "A"
{
ctk
::
VirtualModule
tagDnotA
=
app
.
testModule
.
findTag
(
"D"
).
excludeTag
(
"A"
);
// check direct variables
{
std
::
list
<
ctk
::
VariableNetworkNode
>
&
list
=
tagDnotA
.
getAccessorList
();
BOOST_CHECK
(
list
.
size
()
==
0
);
}
// check number of submodules
{
std
::
list
<
ctk
::
Module
*>
list
=
tagDnotA
.
getSubmoduleList
();
BOOST_CHECK
(
list
.
size
()
==
1
);
}
// check content of submodule "anotherName"
{
std
::
list
<
ctk
::
VariableNetworkNode
>
list
=
tagDnotA
[
"anotherName"
].
getAccessorList
();
BOOST_CHECK
(
list
.
size
()
==
1
);
size_t
foundFoo
=
0
;
for
(
auto
var
:
list
)
{
if
(
var
==
app
.
testModule
.
anotherGroup
.
foo
)
foundFoo
++
;
}
BOOST_CHECK
(
foundFoo
==
1
);
}
}
}
/*********************************************************************************************************************/
/* test correct behaviour when using a std::vector of ApplicationModules */
...
...
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