ChimeraTK-DeviceAccess 03.31.00
Loading...
Searching...
No Matches
testDummyBackendUnified.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#define BOOST_TEST_DYN_LINK
5// Define a name for the test module.
6#define BOOST_TEST_MODULE DummyBackendUnified
7// Only after defining the name include the unit test header.
8#include <boost/test/unit_test.hpp>
9using namespace boost::unit_test_framework;
10
11#include "BackendFactory.h"
12#include "Device.h"
13#include "DummyBackend.h"
16#include "TransferGroup.h"
17#include "UnifiedBackendTest.h"
18
19namespace ChimeraTK {
20 using namespace ChimeraTK;
21}
22using namespace ChimeraTK;
23
24/* ===============================================================================================
25 * This test covers accessors and features that are specific to the DummyBackend
26 * ==============================================================================================*/
27
28// Create a test suite which holds all your tests.
29BOOST_AUTO_TEST_SUITE(DummyBackendUnifiedTestSuite)
30
31/**********************************************************************************************************************/
32
33static std::string cdd("(ExceptionDummy:1?map=test3.map)");
34static auto exceptionDummy =
35 boost::dynamic_pointer_cast<ExceptionDummy>(BackendFactory::getInstance().createBackend(cdd));
36
37/**********************************************************************************************************************/
38
40 std::string path() { return "/DUMMY_INTERRUPT_6"; }
41 bool isWriteable() { return true; }
42 bool isReadable() { return false; }
44 size_t nChannels() { return 1; }
45 size_t nElementsPerChannel() { return 1; }
46 size_t writeQueueLength() { return std::numeric_limits<size_t>::max(); }
47 size_t nRuntimeErrorCases() { return 1; }
48 typedef int32_t minimumUserType;
50
51 static constexpr auto capabilities = TestCapabilities<>()
53 .disableAsyncReadInconsistency()
54 .disableSwitchReadOnly()
55 .disableSwitchWriteOnly()
56 .disableTestWriteNeverLosesData();
57
58 template<typename UserType>
59 std::vector<std::vector<UserType>> generateValue() {
60 return {{1}};
61 }
62
63 template<typename UserType>
64 std::vector<std::vector<UserType>> getRemoteValue() {
65 return {{1}};
66 }
67
69
70 void setForceRuntimeError(bool enable, size_t) {
71 exceptionDummy->throwExceptionRead = enable;
72 exceptionDummy->throwExceptionWrite = enable;
73 exceptionDummy->throwExceptionOpen = enable;
74 }
75};
76
77BOOST_AUTO_TEST_CASE(testRegisterAccessor) {
78 std::cout << "*** testRegisterAccessor *** " << std::endl;
80}
81BOOST_AUTO_TEST_SUITE_END()
Set of AccessMode flags with additional functionality for an easier handling.
Definition AccessMode.h:48
static BackendFactory & getInstance()
Static function to get an instance of factory.
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.
This header collects some conversion routines which should be useful both for ApplicationCore Python ...
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
std::vector< std::vector< UserType > > generateValue()
ChimeraTK::AccessModeFlags supportedFlags()
void setForceRuntimeError(bool enable, size_t)
std::vector< std::vector< UserType > > getRemoteValue()
minimumUserType rawUserType
static constexpr auto capabilities
std::string cdd
BOOST_AUTO_TEST_CASE(testRegisterAccessor)