ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
UnifiedBackendTest.h File Reference
#include "Device.h"
#include "DeviceBackendImpl.h"
#include <boost/fusion/include/at_key.hpp>
#include <boost/test/unit_test.hpp>
#include <functional>
#include <list>
#include <numeric>
#include <string>
#include <thread>
#include <utility>
+ Include dependency graph for UnifiedBackendTest.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ChimeraTK::TestCapabilities< _syncRead, _forceDataLossWrite, _asyncReadInconsistency, _switchReadOnly, _switchWriteOnly, _writeNeverLosesData, _testWriteOnly, _testReadOnly, _testRawTransfer, _testCatalogue, _setRemoteValueIncrementsVersion, _testPartialAccessor >
 Descriptor for the test capabilities for each register. More...
 
class  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >
 Class to test any backend for correct behaviour. More...
 
class  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::EnableDisableActionList
 "Strong typedef" for list of pairs of functors for enabling and disabling a test condition. More...
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::ExceptionReportingBackend
 Special DeviceBackend used for testing the exception reporting to the backend. More...
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::setForceDataLossWrite_proxy_helper< T, condition >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::setForceDataLossWrite_proxy_helper< T, false >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::forceAsyncReadInconsistency_proxy_helper< T, condition >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::forceAsyncReadInconsistency_proxy_helper< T, false >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::switchReadOnly_proxy_helper< T, condition >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::switchReadOnly_proxy_helper< T, false >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::switchWriteOnly_proxy_helper< T, condition >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::switchWriteOnly_proxy_helper< T, false >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::writeQueueLength_proxy_helper< T, condition >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::writeQueueLength_proxy_helper< T, false >
 
class  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::has_nValuesToTest< T >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::nValuesToTest_proxy_helper< T, hasFn >
 
struct  ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::nValuesToTest_proxy_helper< T, false >
 

Namespaces

namespace  ChimeraTK
 
namespace  std
 STL namespace.
 

Macros

#define CHECK_EQUALITY(accessor, expectedValue)
 
#define CHECK_EQUALITY_VECTOR(foundValue, expectedValue)
 
#define CHECK_EQUALITY_TIMEOUT(accessor, expectedValue, maxMilliseconds)
 
#define CHECK_EQUALITY_VECTOR_TIMEOUT(foundValue, expectedValue, maxMilliseconds)
 
#define CHECK_TIMEOUT(condition, maxMilliseconds)
 
#define STORE_APPLICATION_DATA_BUFFER(UserType, accessor)
 Helper macros for test_B_4_2_4 and test_B_4_2_5.
 
#define ALTER_AND_STORE_APPLICATION_BUFFER(UserType, accessor)
 
#define CHECK_APPLICATION_DATA_BUFFER(UserType, accessor)   CHECK_EQUALITY(accessor, STORE_APPLICATION_BUFFER_data)
 
#define CHECK_APPLICATION_BUFFER(UserType, accessor)
 

Enumerations

enum class  ChimeraTK::TestCapability { ChimeraTK::unspecified , ChimeraTK::enabled , ChimeraTK::disabled }
 Used by the Capabilities descriptor. More...
 

Functions

template<typename UserType >
bool ChimeraTK::compareHelper (UserType a, UserType b)
 
template<>
bool ChimeraTK::compareHelper< double > (double a, double b)
 
template<>
bool ChimeraTK::compareHelper< float > (float a, float b)
 
template<>
bool ChimeraTK::compareHelper< std::string > (std::string a, std::string b)
 
std::string std::to_string (const std::string &v)
 
std::string std::to_string (const char *&v)
 

Macro Definition Documentation

◆ ALTER_AND_STORE_APPLICATION_BUFFER

#define ALTER_AND_STORE_APPLICATION_BUFFER (   UserType,
  accessor 
)
Value:
for(size_t i = 0; i < accessor.getNChannels(); ++i) { \
if constexpr(std::is_arithmetic_v<UserType>) \
std::iota(accessor[i].begin(), accessor[i].end(), std::numeric_limits<UserType>::min() + 1); \
if constexpr(std::is_same_v<std::string, UserType>) std::fill(accessor[i].begin(), accessor[i].end(), "FACECAFE"); \
} \
STORE_APPLICATION_DATA_BUFFER(UserType, accessor); \
VersionNumber STORE_APPLICATION_BUFFER_version; \
DataValidity STORE_APPLICATION_BUFFER_validity; \
STORE_APPLICATION_BUFFER_version = accessor.getVersionNumber(); \
STORE_APPLICATION_BUFFER_validity = accessor.dataValidity()

Definition at line 1369 of file UnifiedBackendTest.h.

◆ CHECK_APPLICATION_BUFFER

#define CHECK_APPLICATION_BUFFER (   UserType,
  accessor 
)
Value:
CHECK_APPLICATION_DATA_BUFFER(UserType, accessor); \
BOOST_CHECK(STORE_APPLICATION_BUFFER_version == accessor.getVersionNumber()); \
BOOST_CHECK(STORE_APPLICATION_BUFFER_validity == accessor.dataValidity())
#define CHECK_APPLICATION_DATA_BUFFER(UserType, accessor)

Definition at line 1383 of file UnifiedBackendTest.h.

◆ CHECK_APPLICATION_DATA_BUFFER

#define CHECK_APPLICATION_DATA_BUFFER (   UserType,
  accessor 
)    CHECK_EQUALITY(accessor, STORE_APPLICATION_BUFFER_data)

Definition at line 1381 of file UnifiedBackendTest.h.

◆ CHECK_EQUALITY

#define CHECK_EQUALITY (   accessor,
  expectedValue 
)

Definition at line 714 of file UnifiedBackendTest.h.

◆ CHECK_EQUALITY_TIMEOUT

#define CHECK_EQUALITY_TIMEOUT (   accessor,
  expectedValue,
  maxMilliseconds 
)

Definition at line 787 of file UnifiedBackendTest.h.

◆ CHECK_EQUALITY_VECTOR

#define CHECK_EQUALITY_VECTOR (   foundValue,
  expectedValue 
)

Definition at line 750 of file UnifiedBackendTest.h.

◆ CHECK_EQUALITY_VECTOR_TIMEOUT

#define CHECK_EQUALITY_VECTOR_TIMEOUT (   foundValue,
  expectedValue,
  maxMilliseconds 
)

Definition at line 829 of file UnifiedBackendTest.h.

◆ CHECK_TIMEOUT

#define CHECK_TIMEOUT (   condition,
  maxMilliseconds 
)
Value:
{ \
std::chrono::steady_clock::time_point t0 = std::chrono::steady_clock::now(); \
while(!(condition)) { \
bool timeout_reached = (std::chrono::steady_clock::now() - t0) > std::chrono::milliseconds(maxMilliseconds); \
BOOST_CHECK(!timeout_reached); \
if(timeout_reached) break; \
usleep(1000); \
} \
} \
(void)0

Definition at line 871 of file UnifiedBackendTest.h.

◆ STORE_APPLICATION_DATA_BUFFER

#define STORE_APPLICATION_DATA_BUFFER (   UserType,
  accessor 
)
Value:
std::vector<std::vector<UserType>> STORE_APPLICATION_BUFFER_data; \
for(size_t i = 0; i < accessor.getNChannels(); ++i) { \
STORE_APPLICATION_BUFFER_data.push_back(accessor[i]); \
} \
(void)0

Helper macros for test_B_4_2_4 and test_B_4_2_5.

Definition at line 1362 of file UnifiedBackendTest.h.