4#define BOOST_TEST_DYN_LINK
6#define BOOST_TEST_MODULE AsyncVarAndHierarchicalInterruptsUnified
8#include <boost/test/unit_test.hpp>
9using namespace boost::unit_test_framework;
25 static boost::shared_ptr<DeviceBackend>
createInstance(std::string, std::map<std::string, std::string> parameters) {
26 return boost::make_shared<DummyForCleanupCheck>(parameters[
"map"]);
29 std::cout <<
"~DummyForCleanupCheck()" << std::endl;
57BOOST_AUTO_TEST_SUITE(AsyncVarAndHierarchicalInterruptsUnifiedTestSuite)
61static std::string
cdd(
"(DummyForCleanupCheck:1?map=testHierarchicalInterrupts.map)");
62static auto exceptionDummy =
65template<
class WITHPATH, u
int32_t INTERRUPT>
81 .disableSwitchReadOnly()
82 .disableSwitchWriteOnly()
83 .disableTestWriteNeverLosesData()
84 .enableTestRawTransfer();
88 template<
typename Type>
90 return {{
acc +
static_cast<int32_t
>(INTERRUPT)}};
93 template<
typename UserType>
99 acc = generateValue<minimumUserType>()[0][0];
100 if(!WITHPATH::activeInterruptsPath().empty()) {
102 activeInterrupts = WITHPATH::activeInterruptsValue();
104 if(exceptionDummy->isOpen()) {
105 exceptionDummy->triggerInterrupt(INTERRUPT);
112 exceptionDummy->throwExceptionRead = enable;
113 exceptionDummy->throwExceptionWrite = enable;
114 exceptionDummy->throwExceptionOpen = enable;
115 if(exceptionDummy->isOpen()) {
116 exceptionDummy->triggerInterrupt(INTERRUPT);
124 static std::string
path() {
return "/datafrom6"; }
130 static std::string
path() {
return "/datafrom5_9"; }
136 static std::string
path() {
return "/datafrom4_8_2"; }
141 exceptionDummy.get(),
"",
"/int_ctrls/controller4/active_ints"};
142 activeParentInterrupts = 1U << 8U;
147 static std::string
path() {
return "/datafrom4_8_3"; }
152 exceptionDummy.get(),
"",
"/int_ctrls/controller4/active_ints"};
153 activeParentInterrupts = 1U << 8U;
160template<
class WITHPATH, u
int32_t INTERRUPT>
174 .disableSwitchReadOnly()
175 .disableSwitchWriteOnly()
176 .disableTestWriteNeverLosesData()
177 .disableTestRawTransfer();
179 template<
typename Type>
184 template<
typename UserType>
190 if(!WITHPATH::activeInterruptsPath().empty()) {
192 activeInterrupts = WITHPATH::activeInterruptsValue();
194 if(exceptionDummy->isOpen()) {
195 exceptionDummy->triggerInterrupt(INTERRUPT);
202 exceptionDummy->throwExceptionRead = enable;
203 exceptionDummy->throwExceptionWrite = enable;
204 exceptionDummy->throwExceptionOpen = enable;
205 if(exceptionDummy->isOpen()) {
206 exceptionDummy->triggerInterrupt(INTERRUPT);
214 static std::string
path() {
return "/interrupt6"; }
225 static std::string
path() {
return "/!6"; }
232 static std::string
path() {
return "/interrupt5_9"; }
238 static std::string
path() {
return "/!5"; }
245 static std::string
path() {
return "/!5:9"; }
251 static std::string
path() {
return "/interrupt4_8_2"; }
257 static std::string
path() {
return "/!4"; }
264 static std::string
path() {
return "/!4:8"; }
270 static std::string
path() {
return "/!4:8:2"; }
276 static std::string
path() {
return "/interrupt4_8_3"; }
282 static std::string
path() {
return "/!4"; }
289 static std::string
path() {
return "/!4:8"; }
295 static std::string
path() {
return "/!4:8:3"; }
304 static std::string
path() {
return "/!4:8"; }
309 std::cout <<
"*** testRegisterAccessor *** " << std::endl;
313 .addRegister<datafrom5_9>()
315 .addRegister<datafrom4_8_3>()
317 .addRegister<canonicalInterrupt6>()
319 .addRegister<canonicalInterrupt5>()
321 .addRegister<interrupt4_8_2>()
323 .addRegister<canonicalInterrupt4_8a>()
325 .addRegister<interrupt4_8_3>()
327 .addRegister<canonicalInterrupt4_8b>()
331 exceptionDummy =
nullptr;
338BOOST_AUTO_TEST_SUITE_END()
Set of AccessMode flags with additional functionality for an easier handling.
static BackendFactory & getInstance()
Static function to get an instance of factory.
void registerBackendType(const std::string &backendType, boost::shared_ptr< DeviceBackend >(*creatorFunction)(std::string address, std::map< std::string, std::string > parameters), const std::vector< std::string > &sdmParameterNames={}, const std::string &deviceAccessVersion=CHIMERATK_DEVICEACCESS_VERSION)
Register a backend by the name backendType with the given creatorFunction.
Wrapper Class to avoid vector<bool> problems.
Register accessor for accessing single word or 1D array registers internally of a DummyBackend implem...
ExceptionDummy(std::string const &mapFileName, const std::string &dataConsistencyKeyDescriptor="")
Class to test any backend for correct behaviour.
UnifiedBackendTest< typename boost::mpl::push_back< VECTOR_OF_REGISTERS_T, REG_T >::type > addRegister()
Add a register to be used by the test.
@ wait_for_new_data
Make any read blocking until new data has arrived since the last read.
@ raw
Raw access: disable any possible conversion from the original hardware data type into the given UserT...
std::vector< std::vector< Type > > generateValue(bool raw=false)
void setForceRuntimeError(bool enable, size_t)
size_t nElementsPerChannel()
ChimeraTK::Boolean minimumUserType
size_t writeQueueLength()
ChimeraTK::AccessModeFlags supportedFlags()
void forceAsyncReadInconsistency()
size_t nRuntimeErrorCases()
ChimeraTK::Void rawUserType
static constexpr auto capabilities
std::vector< std::vector< UserType > > getRemoteValue(bool raw=false)
Descriptor for the test capabilities for each register.
constexpr TestCapabilities< _syncRead, TestCapability::disabled, _asyncReadInconsistency, _switchReadOnly, _switchWriteOnly, _writeNeverLosesData, _testWriteOnly, _testReadOnly, _testRawTransfer, _testCatalogue, _setRemoteValueIncrementsVersion, _testPartialAccessor > disableForceDataLossWrite() const
static boost::shared_ptr< DeviceBackend > createInstance(std::string, std::map< std::string, std::string > parameters)
~DummyForCleanupCheck() override
static std::atomic_bool cleanupCalled
static constexpr auto capabilities
void forceAsyncReadInconsistency()
std::vector< std::vector< UserType > > getRemoteValue(bool raw=false)
ChimeraTK::AccessModeFlags supportedFlags()
size_t nElementsPerChannel()
minimumUserType rawUserType
size_t nRuntimeErrorCases()
DummyRegisterAccessor< int32_t > acc
size_t writeQueueLength()
void setForceRuntimeError(bool enable, size_t)
std::vector< std::vector< Type > > generateValue(bool raw=false)
static std::string path()
static std::string activeInterruptsPath()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
size_t nRuntimeErrorCases()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
static uint32_t activeInterruptsValue()
size_t nRuntimeErrorCases()
static std::string path()
static std::string activeInterruptsPath()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
size_t nRuntimeErrorCases()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
static std::string path()
size_t nRuntimeErrorCases()
static uint32_t activeInterruptsValue()
static std::string path()
static std::string activeInterruptsPath()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
static std::string activeInterruptsPath()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string path()
static std::string activeInterruptsPath()
static uint32_t activeInterruptsValue()
static std::string path()
static std::string activeInterruptsPath()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string activeInterruptsPath()
static uint32_t activeInterruptsValue()
static std::string path()
static std::string activeInterruptsPath()
static std::string path()
static uint32_t activeInterruptsValue()
static std::string path()
size_t nRuntimeErrorCases()
static std::string activeInterruptsPath()
static uint32_t activeInterruptsValue()
BOOST_AUTO_TEST_CASE(testRegisterAccessor)