4#define BOOST_TEST_DYN_LINK
5#define BOOST_TEST_MODULE DataConsistencyGroupTest
6#include <boost/test/unit_test.hpp>
7using namespace boost::unit_test_framework;
15BOOST_AUTO_TEST_SUITE(DataConsistencyGroupTestSuite)
19template<
typename UserType>
44 return {this->shared_from_this()};
54 boost::shared_ptr<Accessor<int>> acc_1 = boost::make_shared<Accessor<int>>();
55 boost::shared_ptr<Accessor<int>> acc_2 = boost::make_shared<Accessor<int>>();
58#pragma GCC diagnostic push
59#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
61#pragma GCC diagnostic pop
68 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
70 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
73 acc_1->write(acc_2->getVersionNumber());
75 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
true);
76 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
true);
77 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
true);
78 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
true);
79 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
true);
83 boost::shared_ptr<Accessor<int>> acc_1 = boost::make_shared<Accessor<int>>();
84 boost::shared_ptr<Accessor<int>> acc_2 = boost::make_shared<Accessor<int>>();
85 boost::shared_ptr<Accessor<int>> acc_3 = boost::make_shared<Accessor<int>>();
86 boost::shared_ptr<Accessor<int>> acc_4 = boost::make_shared<Accessor<int>>();
89#pragma GCC diagnostic push
90#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
92#pragma GCC diagnostic pop
98 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
99 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
100 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
false);
101 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
false);
107 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
108 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
109 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
false);
110 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
false);
113 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
114 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
115 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
false);
116 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
false);
119 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
120 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
121 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
false);
122 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
true);
123 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
true);
124 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
true);
125 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
true);
126 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
true);
130 boost::shared_ptr<Accessor<int>> acc_5 = boost::make_shared<Accessor<int>>();
132 BOOST_CHECK(dcgroup.update(acc_5->getId()) ==
false);
137 boost::shared_ptr<Accessor<int>> acc_1 = boost::make_shared<Accessor<int>>();
138 boost::shared_ptr<Accessor<int>> acc_2 = boost::make_shared<Accessor<int>>();
139 boost::shared_ptr<Accessor<int>> acc_3 = boost::make_shared<Accessor<int>>();
140 boost::shared_ptr<Accessor<int>> acc_4 = boost::make_shared<Accessor<int>>();
142#pragma GCC diagnostic push
143#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
146#pragma GCC diagnostic pop
152 BOOST_CHECK(dcgroup_1.update(acc_1->getId()) ==
false);
153 BOOST_CHECK(dcgroup_1.update(acc_2->getId()) ==
false);
154 BOOST_CHECK(dcgroup_1.update(acc_3->getId()) ==
true);
155 BOOST_CHECK(dcgroup_1.update(acc_4->getId()) ==
false);
156 BOOST_CHECK(dcgroup_2.update(acc_1->getId()) ==
false);
157 BOOST_CHECK(dcgroup_2.update(acc_3->getId()) ==
false);
158 BOOST_CHECK(dcgroup_2.update(acc_4->getId()) ==
true);
159 BOOST_CHECK(dcgroup_2.update(acc_2->getId()) ==
false);
167 boost::shared_ptr<Accessor<int>> acc_1 = boost::make_shared<Accessor<int>>();
168 boost::shared_ptr<Accessor<int>> acc_2 = boost::make_shared<Accessor<int>>();
171#pragma GCC diagnostic push
172#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
174#pragma GCC diagnostic pop
177 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_2->getId()),
false);
180 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_1->getId()),
false);
183 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_1->getId()),
true);
187 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_1->getId()),
false);
188 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_2->getId()),
true);
193 dev.
open(
"(dummy?map=registerAccess.map)");
201BOOST_AUTO_TEST_SUITE_END()
bool isReadable() const override
Check if transfer element is readable.
void doPostRead(TransferType, bool) override
Backend specific implementation of postRead().
void doPostWrite(TransferType, VersionNumber) override
Backend specific implementation of postWrite().
void doPreWrite(TransferType, VersionNumber) override
Backend specific implementation of preWrite().
std::vector< boost::shared_ptr< TransferElement > > getHardwareAccessingElements() override
Obtain the underlying TransferElements with actual hardware access.
bool doWriteTransfer(ChimeraTK::VersionNumber) override
Implementation version of writeTransfer().
void doPreRead(TransferType) override
Backend specific implementation of preRead().
std::list< boost::shared_ptr< TransferElement > > getInternalElements() override
Obtain the full list of TransferElements internally used by this TransferElement.
bool isWriteable() const override
Check if transfer element is writeable.
void doReadTransferSynchronously() override
Implementation version of readTransfer() for synchronous reads.
bool isReadOnly() const override
Check if transfer element is read only, i.e.
Group several registers (= TransferElement) which ensures data consistency across multiple variables ...
Class allows to read/write registers from device.
ScalarRegisterAccessor< UserType > getScalarRegisterAccessor(const RegisterPath ®isterPathName, size_t wordOffsetInRegister=0, const AccessModeFlags &flags=AccessModeFlags({})) const
Get a ScalarRegisterObject object for the given register.
void open(std::string const &aliasName)
Open a device by the given alias name from the DMAP file.
N-dimensional register accessor.
Class for generating and holding version numbers without exposing a numeric representation.
Exception thrown when a logic error has occured.
TransferType
Used to indicate the applicable operation on a Transferelement.
BOOST_AUTO_TEST_CASE(testDataConsistencyGroup)