5 #define BOOST_TEST_DYN_LINK
6 #define BOOST_TEST_MODULE LMapBitRangePluginTest
7 #include <boost/test/unit_test.hpp>
8 using namespace boost::unit_test_framework;
14 BOOST_AUTO_TEST_SUITE(LMapBitRangeTestSuite)
20 device.
open(
"(logicalNameMap?map=bitRangeReadPlugin.xlmap)");
28 accTarget.setAndWrite(0x1f0f);
34 BOOST_TEST(accRangedLo == 0x0f);
35 BOOST_TEST(accRangedHi == 0x1f);
36 BOOST_TEST(accRangedMid == 0xf0);
42 accTarget.setAndWrite(0);
44 BOOST_TEST(accRangedLo == 0);
45 BOOST_TEST(accRangedHi == 0);
47 accTarget.setAndWrite(0x5a1f);
49 BOOST_TEST(accRangedLo == 0x1f);
50 BOOST_TEST(accRangedHi == 0x5a);
55 device.
open(
"(logicalNameMap?map=bitRangeReadPlugin.xlmap)");
63 accTarget.setAndWrite(0x1f0f);
68 BOOST_TEST(accRangedMid == 0x60);
70 BOOST_TEST(accTarget == 0x760f);
75 group.addAccessor(accRangedLo);
76 group.addAccessor(accRangedHi);
84 BOOST_TEST(accTarget == 0x7580);
87 group.addAccessor(accRangedMid);
95 device.
open(
"(logicalNameMap?map=bitRangeReadPlugin.xlmap)");
102 accTarget.setAndWrite(0x1fff);
104 BOOST_TEST(accMiddle == 127);
109 accTooLarge.setAndWrite(0xff1);
111 BOOST_CHECK(accTarget == std::numeric_limits<int16_t>::max());
115 accTarget.setAndWrite(0);
118 accMiddle2.setAndWrite(0x100);
120 BOOST_TEST(accTarget == 0x0ff0);
133 device.
open(
"(logicalNameMap?map=bitRangeReadPlugin.xlmap)");
136 accTarget.setAndWrite(0x1fff);
140 accClamped.setAndWrite(0x01);
143 BOOST_TEST(accTarget == 0x1f01);
147 accClamped.setAndWrite(55);
151 BOOST_TEST(accTarget == 0x1f05);
159 device.
open(
"(logicalNameMap?map=bitRangeReadPlugin.xlmap)");
162 accTarget.setAndWrite(0x5555);
178 BOOST_TEST(!accBit1);
180 BOOST_TEST(!accBit3);
184 accRangedHi.setAndWrite(0x11);
187 BOOST_TEST(accTarget == 0x1155);
195 BOOST_TEST(!accBit1);
197 BOOST_TEST(!accBit3);
200 accBit1.setAndWrite(
true);
201 accBit3.setAndWrite(
true);
205 BOOST_TEST(accTarget == 0x115F);
207 BOOST_TEST(accRangedHi == 0x11);
214 device.
open(
"(logicalNameMap?map=bitRangeReadPlugin.xlmap)");
217 accTarget.setAndWrite(0x5555);
224 BOOST_TEST(accLo == 85);
225 BOOST_TEST(accLoSigned == 85);
227 accTarget.setAndWrite(0x5580);
232 BOOST_TEST(
int(accLo) == 128);
233 BOOST_TEST(
int(accLoSigned) == -128);
235 accTarget.setAndWrite(0x5555);
238 BOOST_TEST(accFixed == 5.3125);
243 BOOST_AUTO_TEST_SUITE_END()