40#include <boost/test/unit_test.hpp>
48#define N_1MB uint32_t(1024*1024/4)
57 HwInterface
hw = getHwInterface();
63 uint32_t x1 =
static_cast<uint32_t
> ( rand() );
66 uint32_t x2 =
static_cast<uint32_t
> ( rand() );
69 std::vector<uint32_t> xx1;
71 for (
size_t i=0; i!=
N_1MB; ++i )
73 xx1.push_back (
static_cast<uint32_t
> ( rand() ) );
78 std::vector<uint32_t> xx2;
80 for (
size_t i=0; i!=
N_1MB; ++i )
82 xx2.
push_back (
static_cast<uint32_t
> ( rand() ) );
96 bool correct_block_write_read_subsystem1 =
true;
97 ValVector< uint32_t >::const_iterator i1=mem1.
begin();
98 std::vector< uint32_t >::const_iterator j1=xx1.begin();
100 for ( ; i1!=mem1.
end(); ++i1 , ++j1 )
102 correct_block_write_read_subsystem1 = correct_block_write_read_subsystem1 && ( *i1 == *j1 );
106 BOOST_CHECK ( correct_block_write_read_subsystem1 );
108 bool correct_block_write_read_subsystem2 =
true;
109 ValVector< uint32_t >::const_iterator i2=mem2.
begin();
110 std::vector< uint32_t >::const_iterator j2=xx2.begin();
112 for ( ; i2!=mem2.
end(); ++i2 , ++j2 )
114 correct_block_write_read_subsystem2 = correct_block_write_read_subsystem2 && ( *i2 == *j2 );
118 BOOST_CHECK ( correct_block_write_read_subsystem2 );
const Node & getNode() const
Retrieve the top-level node.
void dispatch()
Make the IPbus client issue a dispatch.
ValWord< uint32_t > read() const
Read a single, unmasked, unsigned word.
ValHeader writeBlock(const std::vector< uint32_t > &aValues) const
Write a block of data to a block of registers or a block-write port.
ValHeader write(const uint32_t &aValue) const
Write a single, unmasked word to a register.
const uint32_t & getAddress() const
Return the register address with which this node is associated.
ValVector< uint32_t > readBlock(const uint32_t &aSize) const
Read a block of unsigned data from a block of registers or a block-read port.
const_iterator begin() const
If the memory has previously been marked as valid, return a const iterator to the beginning of the un...
void push_back(const T &aValue)
If the memory has not previously been marked as valid, add an entry to the end of it.
bool valid()
Return whether the Validated memory is marked as valid.
const T & at(std::size_t aIndex) const
If the memory has previously been marked as valid, give random access into memory.
const_iterator end() const
If the memory has previously been marked as valid, return a const iterator to the end (one past last ...
std::size_t size() const
Return the size of the underlying memory.
T value() const
Return the value of the validated memory with check on validity.
BOOST_CHECK_THROW(hw.getNode("REG").writeBlockOffset(xx, 0), uhal::exception::BulkTransferOffsetRequestedForSingleRegister)
BOOST_CHECK_EQUAL(mem.size(), N)
BOOST_CHECK_NO_THROW(hw.getNode("REG").writeBlock(xx))
BOOST_CHECK(!mem.valid())
#define UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(test_suite_name, test_case_name, test_fixture, test_case_contents)