4 #define BOOST_TEST_DYN_LINK
5 #define BOOST_TEST_MODULE DataConsistencyGroupTest
6 #include <boost/test/unit_test.hpp>
7 using namespace boost::unit_test_framework;
15 BOOST_AUTO_TEST_SUITE(DataConsistencyGroupTestSuite)
19 template<
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>>();
64 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
66 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
69 acc_1->write(acc_2->getVersionNumber());
71 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
true);
72 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
true);
73 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
true);
74 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
true);
75 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
true);
79 boost::shared_ptr<Accessor<int>> acc_1 = boost::make_shared<Accessor<int>>();
80 boost::shared_ptr<Accessor<int>> acc_2 = boost::make_shared<Accessor<int>>();
81 boost::shared_ptr<Accessor<int>> acc_3 = boost::make_shared<Accessor<int>>();
82 boost::shared_ptr<Accessor<int>> acc_4 = boost::make_shared<Accessor<int>>();
90 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
91 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
92 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
false);
93 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
false);
99 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
100 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
101 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
false);
102 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
false);
105 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
106 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
107 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
false);
108 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
false);
111 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
false);
112 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
false);
113 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
false);
114 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
true);
115 BOOST_CHECK(dcgroup.update(acc_2->getId()) ==
true);
116 BOOST_CHECK(dcgroup.update(acc_4->getId()) ==
true);
117 BOOST_CHECK(dcgroup.update(acc_3->getId()) ==
true);
118 BOOST_CHECK(dcgroup.update(acc_1->getId()) ==
true);
122 boost::shared_ptr<Accessor<int>> acc_5 = boost::make_shared<Accessor<int>>();
124 BOOST_CHECK(dcgroup.update(acc_5->getId()) ==
false);
129 boost::shared_ptr<Accessor<int>> acc_1 = boost::make_shared<Accessor<int>>();
130 boost::shared_ptr<Accessor<int>> acc_2 = boost::make_shared<Accessor<int>>();
131 boost::shared_ptr<Accessor<int>> acc_3 = boost::make_shared<Accessor<int>>();
132 boost::shared_ptr<Accessor<int>> acc_4 = boost::make_shared<Accessor<int>>();
140 BOOST_CHECK(dcgroup_1.update(acc_1->getId()) ==
false);
141 BOOST_CHECK(dcgroup_1.update(acc_2->getId()) ==
false);
142 BOOST_CHECK(dcgroup_1.update(acc_3->getId()) ==
true);
143 BOOST_CHECK(dcgroup_1.update(acc_4->getId()) ==
false);
144 BOOST_CHECK(dcgroup_2.update(acc_1->getId()) ==
false);
145 BOOST_CHECK(dcgroup_2.update(acc_3->getId()) ==
false);
146 BOOST_CHECK(dcgroup_2.update(acc_4->getId()) ==
true);
147 BOOST_CHECK(dcgroup_2.update(acc_2->getId()) ==
false);
155 boost::shared_ptr<Accessor<int>> acc_1 = boost::make_shared<Accessor<int>>();
156 boost::shared_ptr<Accessor<int>> acc_2 = boost::make_shared<Accessor<int>>();
161 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_2->getId()),
false);
164 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_1->getId()),
false);
167 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_1->getId()),
true);
171 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_1->getId()),
false);
172 BOOST_CHECK_EQUAL(dcgroup_1.update(acc_2->getId()),
true);
177 dev.
open(
"(dummy?map=registerAccess.map)");
184 BOOST_AUTO_TEST_SUITE_END()