Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ControlSystemAdapter-DoocsAdapter
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
ControlSystemAdapter-DoocsAdapter
Commits
510a8453
Commit
510a8453
authored
7 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
added missing file for tests
parent
946d6539
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/include/serverBasedTestTools.h
+48
-0
48 additions, 0 deletions
tests/include/serverBasedTestTools.h
with
48 additions
and
0 deletions
tests/include/serverBasedTestTools.h
0 → 100644
+
48
−
0
View file @
510a8453
#ifndef SERVER_BASED_TEST_TOOLS_H
#define SERVER_BASED_TEST_TOOLS_H
#include
<eq_fct.h>
#include
"basenameFromAddress.h"
// these constants don't exist in DOOCS, although they should. We define them here for better code readability
static
const
int
ACCESS_RO
=
0
;
// read only
static
const
int
ACCESS_RW
=
1
;
// read/write
template
<
class
DOOCS_T
>
void
checkHistory
(
DOOCS_T
*
property
,
bool
expected_has_history
){
bool
has_history
=
property
->
get_histPointer
();
BOOST_CHECK_MESSAGE
(
has_history
==
expected_has_history
,
"History on/off wrong for "
+
property
->
basename
()
+
". Should be "
+
(
expected_has_history
?
"true"
:
"false"
));
}
template
<
>
void
checkHistory
(
D_spectrum
*
/*property*/
,
bool
){
// nothing to do, spectra don't have history
}
template
<
class
DOOCS_T
>
void
checkDoocsProperty
(
std
::
string
const
&
propertyAddress
,
bool
expected_has_history
=
true
,
bool
expected_is_writeable
=
true
){
// copied from DoocsServerTestHelper::doocsGet
EqAdr
ad
;
EqData
ed
,
res
;
// obtain location pointer
ad
.
adr
(
propertyAddress
.
c_str
());
EqFct
*
eqFct
=
eq_get
(
&
ad
);
BOOST_REQUIRE_MESSAGE
(
eqFct
,
"Could not get location for property "
+
propertyAddress
);
auto
propertyName
=
ChimeraTK
::
basenameFromAddress
(
propertyAddress
);
DOOCS_T
*
property
=
dynamic_cast
<
DOOCS_T
*>
(
eqFct
->
find_property
(
propertyName
));
BOOST_REQUIRE_MESSAGE
(
property
,
"Could not find property "
+
propertyName
+
" (address "
<<
propertyAddress
<<
"), or property has unexpected type."
);
checkHistory
(
property
,
expected_has_history
);
std
::
stringstream
errorMessage
;
errorMessage
<<
"Access rights not correct for '"
<<
propertyAddress
<<
"': access word is "
<<
property
->
get_access
()
<<
", expected "
<<
(
expected_is_writeable
?
ACCESS_RW
:
ACCESS_RO
);
if
(
expected_is_writeable
){
BOOST_CHECK_MESSAGE
(
property
->
get_access
()
==
ACCESS_RW
,
errorMessage
.
str
());
}
else
{
BOOST_CHECK
(
property
->
get_access
()
==
ACCESS_RO
);
}
}
#endif // SERVER_BASED_TEST_TOOLS_H
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