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
66c4a1e5
Commit
66c4a1e5
authored
8 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
added tests for multiple consumers and some combinations of pull and push mode
parent
9e062761
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/testAccessors.cc
+95
-0
95 additions, 0 deletions
tests/executables_src/testAccessors.cc
with
95 additions
and
0 deletions
tests/executables_src/testAccessors.cc
+
95
−
0
View file @
66c4a1e5
...
...
@@ -36,6 +36,11 @@ class TestModule : public ctk::ApplicationModule {
SCALAR_ACCESSOR
(
T
,
consumingPush2
,
ctk
::
VariableDirection
::
consuming
,
"MV/m"
,
ctk
::
UpdateMode
::
push
);
SCALAR_ACCESSOR
(
T
,
consumingPush3
,
ctk
::
VariableDirection
::
consuming
,
"MV/m"
,
ctk
::
UpdateMode
::
push
);
SCALAR_ACCESSOR
(
T
,
feedingPoll
,
ctk
::
VariableDirection
::
feeding
,
"MV/m"
,
ctk
::
UpdateMode
::
poll
);
SCALAR_ACCESSOR
(
T
,
consumingPoll
,
ctk
::
VariableDirection
::
consuming
,
"MV/m"
,
ctk
::
UpdateMode
::
poll
);
SCALAR_ACCESSOR
(
T
,
consumingPoll2
,
ctk
::
VariableDirection
::
consuming
,
"MV/m"
,
ctk
::
UpdateMode
::
poll
);
SCALAR_ACCESSOR
(
T
,
consumingPoll3
,
ctk
::
VariableDirection
::
consuming
,
"MV/m"
,
ctk
::
UpdateMode
::
poll
);
void
mainLoop
()
{}
};
...
...
@@ -148,3 +153,93 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testFourScalarPushAccessors, T, test_types ) {
BOOST_CHECK
(
testModule
.
consumingPush3
==
120
);
}
/*********************************************************************************************************************/
/* test case for two scalar accessors in poll mode */
BOOST_AUTO_TEST_CASE_TEMPLATE
(
testTwoScalarPollAccessors
,
T
,
test_types
)
{
TestApplication
app
(
"Test Suite"
);
TestModule
<
T
>
testModule
;
testModule
.
feedingPoll
.
connectTo
(
testModule
.
consumingPoll
);
app
.
makeConnections
();
// single theaded test only, since read() does not block in this case
testModule
.
consumingPoll
=
0
;
testModule
.
feedingPoll
=
42
;
BOOST_CHECK
(
testModule
.
consumingPoll
==
0
);
testModule
.
feedingPoll
.
write
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
0
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
feedingPoll
=
120
;
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
feedingPoll
.
write
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
120
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
120
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
120
);
}
/*********************************************************************************************************************/
/* test case for two scalar accessors, feeder in push mode and consumer in poll mode */
BOOST_AUTO_TEST_CASE_TEMPLATE
(
testTwoScalarPushPollAccessors
,
T
,
test_types
)
{
TestApplication
app
(
"Test Suite"
);
TestModule
<
T
>
testModule
;
testModule
.
feedingPush
.
connectTo
(
testModule
.
consumingPoll
);
app
.
makeConnections
();
// single theaded test only, since read() does not block in this case
testModule
.
consumingPoll
=
0
;
testModule
.
feedingPush
=
42
;
BOOST_CHECK
(
testModule
.
consumingPoll
==
0
);
testModule
.
feedingPush
.
write
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
0
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
feedingPush
=
120
;
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
feedingPush
.
write
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
42
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
120
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
120
);
testModule
.
consumingPoll
.
read
();
BOOST_CHECK
(
testModule
.
consumingPoll
==
120
);
}
/*********************************************************************************************************************/
/* test case for two scalar accessors, feeder in poll mode and consumer in push mode (without trigger) */
BOOST_AUTO_TEST_CASE_TEMPLATE
(
testTwoScalarPollPushAccessors
,
T
,
test_types
)
{
TestApplication
app
(
"Test Suite"
);
TestModule
<
T
>
testModule
;
testModule
.
feedingPoll
.
connectTo
(
testModule
.
consumingPush
);
try
{
app
.
makeConnections
();
BOOST_ERROR
(
"Exception expected."
);
}
catch
(
ctk
::
ApplicationExceptionWithID
<
ctk
::
ApplicationExceptionID
::
illegalVariableNetwork
>
&
e
)
{
}
}
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