4 #define BOOST_TEST_DYN_LINK
5 #define BOOST_TEST_MODULE GetSetAsCookedTest
6 #include <boost/test/unit_test.hpp>
7 using namespace boost::unit_test_framework;
19 scalarRawAccessor = 25;
21 BOOST_CHECK(std::fabs(scalarRawAccessor.getAsCooked<
double>() - 25. / 8) < 0.0001);
23 scalarRawAccessor.setAsCooked(31. / 8);
24 BOOST_CHECK_EQUAL(int32_t(scalarRawAccessor), 31);
26 auto oneDRawAccessor = d.
getOneDRegisterAccessor<int32_t>(
"ADC/AREA_DMAABLE_FIXEDPOINT16_3", 0, 0, {AccessMode::raw});
28 oneDRawAccessor[0] = 12;
29 oneDRawAccessor[1] = 13;
32 BOOST_CHECK(std::fabs(oneDRawAccessor.getAsCooked<
double>(0) - 12. / 8) < 0.0001);
33 BOOST_CHECK(std::fabs(oneDRawAccessor.getAsCooked<
double>(1) - 13. / 8) < 0.0001);
35 oneDRawAccessor.setAsCooked(0, 42. / 8);
36 oneDRawAccessor.setAsCooked(1, 43. / 8);
38 BOOST_CHECK_EQUAL(oneDRawAccessor[0], 42);
39 BOOST_CHECK_EQUAL(oneDRawAccessor[1], 43);