ChimeraTK-DeviceAccess  03.18.00
testTransferGroup.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "CopyRegisterDecorator.h"
#include "Device.h"
#include "ExceptionDummyBackend.h"
#include "NDRegisterAccessorDecorator.h"
#include "NumericAddressedLowLevelTransferElement.h"
#include "TransferElementTestAccessor.h"
#include "TransferGroup.h"
+ Include dependency graph for testTransferGroup.cpp:

Go to the source code of this file.

Classes

struct  CountingDecorator< T >
 

Macros

#define BOOST_TEST_DYN_LINK
 
#define BOOST_TEST_MODULE   TransferGroupTest
 
#define CHECK_COUNTERS_HIGH_LEVEL(te, isWrite, expectedOrderPreMax, expectedOrderPostMin, expectTransfer)
 
#define CHECK_COUNTERS_MID_LEVEL(te)
 
#define CHECK_COUNTERS_LOW_LEVEL(te, isWrite, expectedOrderMin, expectedOrderMax)
 

Functions

boost::shared_ptr< TransferElementTestAccessor< int32_t > > makeTETA (AccessModeFlags flags={})
 
 BOOST_AUTO_TEST_CASE (test_B_12_1_3)
 Tests for single specification points. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_3)
 Test that individual operations are not allowed. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_4)
 Test readOnly groups. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_5)
 Test that adding same TE twice throws. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_6)
 Test that adding same TE to two different groups throws. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_7)
 Test that adding TE with wait_for_new_data throws. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_8)
 Test optimisation with copy decorator on abstractor level. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_9)
 Test read/write operations. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_10_1_1)
 Test runtime_error in precondition check. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_10_1_2)
 Test that operation throws if precondition not met. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_10_3)
 Test that exceptions are propagated to high-level elements. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_10_4)
 Test that all postXxx() called even when exception thrown, and exception is thrown in the end. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_10_5)
 Test that thrown exception is identical to the first error. More...
 
 BOOST_AUTO_TEST_CASE (test_B_12_11_1)
 Test that updateDataBuffer == false after exception. More...
 
 BOOST_AUTO_TEST_CASE (testExceptionHandling)
 Higher-level tests. More...
 
 BOOST_AUTO_TEST_CASE (testAdding)
 
 BOOST_AUTO_TEST_CASE (testCallsToPrePostFunctionsInDecorator)
 
 BOOST_AUTO_TEST_CASE (testCallsToPrePostFunctionsInLowLevel)
 
 BOOST_AUTO_TEST_CASE (testTemporaryAbstractorWorks)
 

Macro Definition Documentation

◆ BOOST_TEST_DYN_LINK

#define BOOST_TEST_DYN_LINK

Definition at line 4 of file testTransferGroup.cpp.

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   TransferGroupTest

Definition at line 5 of file testTransferGroup.cpp.

◆ CHECK_COUNTERS_HIGH_LEVEL

#define CHECK_COUNTERS_HIGH_LEVEL (   te,
  isWrite,
  expectedOrderPreMax,
  expectedOrderPostMin,
  expectTransfer 
)
Value:
if(!isWrite) { \
BOOST_CHECK_EQUAL(te->_preRead_counter, 1); \
BOOST_CHECK_EQUAL(te->_preWrite_counter, 0); \
BOOST_CHECK_EQUAL(te->_postRead_counter, 1); \
BOOST_CHECK_EQUAL(te->_postWrite_counter, 0); \
if(expectTransfer) { \
BOOST_CHECK_EQUAL(te->_readTransfer_counter, 1); \
} \
} \
else { \
BOOST_CHECK_EQUAL(te->_preRead_counter, 0); \
BOOST_CHECK_EQUAL(te->_preWrite_counter, 1); \
BOOST_CHECK_EQUAL(te->_postRead_counter, 0); \
BOOST_CHECK_EQUAL(te->_postWrite_counter, 1); \
if(expectTransfer) { \
BOOST_CHECK_EQUAL(te->_writeTransfer_counter, 1); \
} \
} \
if(!expectTransfer) { \
BOOST_CHECK_EQUAL(te->_readTransfer_counter, 0); \
BOOST_CHECK_EQUAL(te->_writeTransfer_counter, 0); \
} \
\
BOOST_CHECK(te->_preIndex <= expectedOrderPreMax); \
BOOST_CHECK(te->_postIndex >= expectedOrderPostMin)

Definition at line 201 of file testTransferGroup.cpp.

◆ CHECK_COUNTERS_LOW_LEVEL

#define CHECK_COUNTERS_LOW_LEVEL (   te,
  isWrite,
  expectedOrderMin,
  expectedOrderMax 
)
Value:
BOOST_CHECK_EQUAL(te->_preRead_counter, 0); /* our test accessor does not delegate this... */ \
BOOST_CHECK_EQUAL(te->_preWrite_counter, 0); \
if(!isWrite) { \
BOOST_CHECK_EQUAL(te->_readTransfer_counter, 1); \
BOOST_CHECK_EQUAL(te->_writeTransfer_counter, 0); \
} \
else { \
BOOST_CHECK_EQUAL(te->_readTransfer_counter, 0); \
BOOST_CHECK_EQUAL(te->_writeTransfer_counter, 1); \
} \
BOOST_CHECK_EQUAL(te->_postRead_counter, 0); /* our test accessor does not delegate this... */ \
BOOST_CHECK_EQUAL(te->_postWrite_counter, 0); \
\
BOOST_CHECK(te->_transferIndex >= expectedOrderMin); \
BOOST_CHECK(te->_transferIndex <= expectedOrderMax)

Definition at line 236 of file testTransferGroup.cpp.

◆ CHECK_COUNTERS_MID_LEVEL

#define CHECK_COUNTERS_MID_LEVEL (   te)
Value:
BOOST_CHECK_EQUAL(te->_preRead_counter, 0); /* our test accessor does not delegate this...*/ \
BOOST_CHECK_EQUAL(te->_preWrite_counter, 0); \
BOOST_CHECK_EQUAL(te->_readTransfer_counter, 0); \
BOOST_CHECK_EQUAL(te->_writeTransfer_counter, 0); \
BOOST_CHECK_EQUAL(te->_postRead_counter, 0); /* our test accessor does not delegate this... */ \
BOOST_CHECK_EQUAL(te->_postWrite_counter, 0)

Definition at line 228 of file testTransferGroup.cpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/19]

BOOST_AUTO_TEST_CASE ( test_B_12_10_1_1  )

Test runtime_error in precondition check.

Definition at line 299 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/19]

BOOST_AUTO_TEST_CASE ( test_B_12_10_1_2  )

Test that operation throws if precondition not met.

Definition at line 322 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/19]

BOOST_AUTO_TEST_CASE ( test_B_12_10_3  )

Test that exceptions are propagated to high-level elements.

INCOMPLETE: Only tested for reading. Test for writing is missing.

Definition at line 364 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/19]

BOOST_AUTO_TEST_CASE ( test_B_12_10_4  )

Test that all postXxx() called even when exception thrown, and exception is thrown in the end.

Definition at line 395 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/19]

BOOST_AUTO_TEST_CASE ( test_B_12_10_5  )

Test that thrown exception is identical to the first error.

Attention: With spec V1.RC11 this test has become incomplete! Tests for runtime_errors in preXxx are missing.

Definition at line 464 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/19]

BOOST_AUTO_TEST_CASE ( test_B_12_11_1  )

Test that updateDataBuffer == false after exception.

Definition at line 524 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/19]

BOOST_AUTO_TEST_CASE ( test_B_12_1_3  )

Tests for single specification points.

Test that replaceTransferElement() is called in addElement()

Definition at line 34 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/19]

BOOST_AUTO_TEST_CASE ( test_B_12_3  )

Test that individual operations are not allowed.

Definition at line 71 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/19]

BOOST_AUTO_TEST_CASE ( test_B_12_4  )

Test readOnly groups.

Definition at line 89 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/19]

BOOST_AUTO_TEST_CASE ( test_B_12_5  )

Test that adding same TE twice throws.

Definition at line 135 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/19]

BOOST_AUTO_TEST_CASE ( test_B_12_6  )

Test that adding same TE to two different groups throws.

Definition at line 149 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/19]

BOOST_AUTO_TEST_CASE ( test_B_12_7  )

Test that adding TE with wait_for_new_data throws.

Definition at line 164 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/19]

BOOST_AUTO_TEST_CASE ( test_B_12_8  )

Test optimisation with copy decorator on abstractor level.

Definition at line 177 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [14/19]

BOOST_AUTO_TEST_CASE ( test_B_12_9  )

Test read/write operations.

Definition at line 259 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [15/19]

BOOST_AUTO_TEST_CASE ( testAdding  )

Definition at line 632 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [16/19]

BOOST_AUTO_TEST_CASE ( testCallsToPrePostFunctionsInDecorator  )

Definition at line 831 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [17/19]

BOOST_AUTO_TEST_CASE ( testCallsToPrePostFunctionsInLowLevel  )
Todo:
FIXME transfer group should become read-only in this scenario!!!

Definition at line 954 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [18/19]

BOOST_AUTO_TEST_CASE ( testExceptionHandling  )

Higher-level tests.

Definition at line 571 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [19/19]

BOOST_AUTO_TEST_CASE ( testTemporaryAbstractorWorks  )

Definition at line 1084 of file testTransferGroup.cpp.

+ Here is the call graph for this function:

◆ makeTETA()

boost::shared_ptr<TransferElementTestAccessor<int32_t> > makeTETA ( AccessModeFlags  flags = {})

Definition at line 20 of file testTransferGroup.cpp.

+ Here is the caller graph for this function: