ChimeraTK-DeviceAccess  03.18.00
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 >
 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

 ChimeraTK
 

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 ALTER_AND_STORE_APPLICATION_BUFFER(UserType, accessor)
 Helper macros for test_B_4_2_4. More...
 
#define CHECK_APPLICATION_BUFFER(UserType, accessor)
 

Enumerations

enum  ChimeraTK::TestCapability { ChimeraTK::TestCapability::unspecified, ChimeraTK::TestCapability::enabled, ChimeraTK::TestCapability::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:
std::vector<std::vector<UserType>> STORE_APPLICATION_BUFFER_data; \
VersionNumber STORE_APPLICATION_BUFFER_version; \
DataValidity STORE_APPLICATION_BUFFER_validity; \
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_BUFFER_data.push_back(accessor[i]); \
} \
STORE_APPLICATION_BUFFER_version = accessor.getVersionNumber(); \
STORE_APPLICATION_BUFFER_validity = accessor.dataValidity()

Helper macros for test_B_4_2_4.

Definition at line 1198 of file UnifiedBackendTest.h.

◆ CHECK_APPLICATION_BUFFER

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

Definition at line 1211 of file UnifiedBackendTest.h.

◆ CHECK_EQUALITY

#define CHECK_EQUALITY (   accessor,
  expectedValue 
)

Definition at line 692 of file UnifiedBackendTest.h.

◆ CHECK_EQUALITY_TIMEOUT

#define CHECK_EQUALITY_TIMEOUT (   accessor,
  expectedValue,
  maxMilliseconds 
)

Definition at line 765 of file UnifiedBackendTest.h.

◆ CHECK_EQUALITY_VECTOR

#define CHECK_EQUALITY_VECTOR (   foundValue,
  expectedValue 
)

Definition at line 728 of file UnifiedBackendTest.h.

◆ CHECK_EQUALITY_VECTOR_TIMEOUT

#define CHECK_EQUALITY_VECTOR_TIMEOUT (   foundValue,
  expectedValue,
  maxMilliseconds 
)

Definition at line 807 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 849 of file UnifiedBackendTest.h.

Function Documentation

◆ to_string() [1/2]

std::string std::to_string ( const char *&  v)
inline

Definition at line 675 of file UnifiedBackendTest.h.

◆ to_string() [2/2]

std::string std::to_string ( const std::string &  v)
inline

Definition at line 672 of file UnifiedBackendTest.h.

ChimeraTK::testable_rebot_sleep::now
boost::chrono::steady_clock::time_point now()
Definition: testableRebotSleep.cc:7
CHECK_EQUALITY
#define CHECK_EQUALITY(accessor, expectedValue)
Definition: UnifiedBackendTest.h:692