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
453fb816
Commit
453fb816
authored
8 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
added test for late initialised accessors
parent
024c2758
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/testAppModuleConnections.cc
+76
-0
76 additions, 0 deletions
tests/executables_src/testAppModuleConnections.cc
with
76 additions
and
0 deletions
tests/executables_src/testAppModuleConnections.cc
+
76
−
0
View file @
453fb816
...
...
@@ -50,6 +50,14 @@ struct TestModule : public ctk::ApplicationModule {
ctk
::
ArrayOutput
<
T
>
feedingArray
{
this
,
"feedingArray"
,
"m"
,
10
,
"Descrption"
};
ctk
::
ScalarPollInput
<
T
>
lateConstrScalarPollInput
;
ctk
::
ScalarPushInput
<
T
>
lateConstrScalarPushInput
;
ctk
::
ScalarOutput
<
T
>
lateConstrScalarOutput
;
ctk
::
ArrayPollInput
<
T
>
lateConstrArrayPollInput
;
ctk
::
ArrayPushInput
<
T
>
lateConstrArrayPushInput
;
ctk
::
ArrayOutput
<
T
>
lateConstrArrayOutput
;
void
mainLoop
()
{}
};
...
...
@@ -242,3 +250,71 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTwoArrayAccessors, T, test_types ) {
for
(
unsigned
int
i
=
0
;
i
<
10
;
++
i
)
BOOST_CHECK
(
app
.
testModule
.
consumingPushArray
[
i
]
==
42
-
(
T
)
i
);
}
/*********************************************************************************************************************/
/* test case for late constructing accessors */
BOOST_AUTO_TEST_CASE_TEMPLATE
(
testLateConstruction
,
T
,
test_types
)
{
std
::
cout
<<
"*** testLateConstruction<"
<<
typeid
(
T
).
name
()
<<
">"
<<
std
::
endl
;
TestApplication
<
T
>
app
;
// create the scalars
app
.
testModule
.
lateConstrScalarPollInput
.
replace
(
ctk
::
ScalarPollInput
<
T
>
(
&
app
.
testModule
,
"LateName1"
,
""
,
""
)
);
app
.
testModule
.
lateConstrScalarPushInput
.
replace
(
ctk
::
ScalarPushInput
<
T
>
(
&
app
.
testModule
,
"LateName2"
,
""
,
""
)
);
app
.
testModule
.
lateConstrScalarOutput
.
replace
(
ctk
::
ScalarOutput
<
T
>
(
&
app
.
testModule
,
"LateName3"
,
""
,
""
)
);
// connect the scalars
app
.
testModule
.
lateConstrScalarOutput
>>
app
.
testModule
.
lateConstrScalarPollInput
;
app
.
testModule
.
feedingPush
>>
app
.
testModule
.
lateConstrScalarPushInput
;
// create the arrays
app
.
testModule
.
lateConstrArrayPollInput
.
replace
(
ctk
::
ArrayPollInput
<
T
>
(
&
app
.
testModule
,
"LateName4"
,
""
,
10
,
""
)
);
app
.
testModule
.
lateConstrArrayPushInput
.
replace
(
ctk
::
ArrayPushInput
<
T
>
(
&
app
.
testModule
,
"LateName5"
,
""
,
10
,
""
)
);
app
.
testModule
.
lateConstrArrayOutput
.
replace
(
ctk
::
ArrayOutput
<
T
>
(
&
app
.
testModule
,
"LateName6"
,
""
,
10
,
""
)
);
// connect the arrays
app
.
testModule
.
lateConstrArrayOutput
>>
app
.
testModule
.
lateConstrArrayPollInput
;
app
.
testModule
.
feedingArray
>>
app
.
testModule
.
lateConstrArrayPushInput
;
// run the app
app
.
initialise
();
app
.
run
();
// test the scalars
app
.
testModule
.
feedingPush
=
42
;
app
.
testModule
.
feedingPush
.
write
();
app
.
testModule
.
lateConstrScalarPushInput
.
read
();
BOOST_CHECK
(
app
.
testModule
.
lateConstrScalarPushInput
==
42
);
app
.
testModule
.
feedingPush
=
43
;
app
.
testModule
.
feedingPush
.
write
();
app
.
testModule
.
lateConstrScalarPushInput
.
read
();
BOOST_CHECK
(
app
.
testModule
.
lateConstrScalarPushInput
==
43
);
app
.
testModule
.
lateConstrScalarOutput
=
120
;
app
.
testModule
.
lateConstrScalarOutput
.
write
();
app
.
testModule
.
lateConstrScalarPollInput
.
read
();
BOOST_CHECK
(
app
.
testModule
.
lateConstrScalarPollInput
==
120
);
app
.
testModule
.
lateConstrScalarPollInput
.
read
();
BOOST_CHECK
(
app
.
testModule
.
lateConstrScalarPollInput
==
120
);
// test the arrays
app
.
testModule
.
feedingArray
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
};
app
.
testModule
.
feedingArray
.
write
();
app
.
testModule
.
lateConstrArrayPushInput
.
read
();
for
(
T
i
=
0
;
i
<
10
;
++
i
)
BOOST_CHECK
(
app
.
testModule
.
lateConstrArrayPushInput
[
i
]
==
i
+
1
);
app
.
testModule
.
feedingArray
=
{
10
,
20
,
30
,
40
,
50
,
60
,
70
,
80
,
90
,
100
};
app
.
testModule
.
feedingArray
.
write
();
app
.
testModule
.
lateConstrArrayPushInput
.
read
();
for
(
T
i
=
0
;
i
<
10
;
++
i
)
BOOST_CHECK
(
app
.
testModule
.
lateConstrArrayPushInput
[
i
]
==
(
i
+
1
)
*
10
);
app
.
testModule
.
lateConstrArrayOutput
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
};
app
.
testModule
.
lateConstrArrayOutput
.
write
();
app
.
testModule
.
lateConstrArrayPollInput
.
read
();
for
(
T
i
=
0
;
i
<
10
;
++
i
)
BOOST_CHECK
(
app
.
testModule
.
lateConstrArrayPollInput
[
i
]
==
i
);
app
.
testModule
.
lateConstrArrayPollInput
.
read
();
for
(
T
i
=
0
;
i
<
10
;
++
i
)
BOOST_CHECK
(
app
.
testModule
.
lateConstrArrayPollInput
[
i
]
==
i
);
}
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