36 const size_t TEST_ELM_SIZE =
sizeof(uint);
37 const uint MAX_ELMS = 50;
39 std::vector<uint> testNumbers(MAX_ELMS);
45 void* mem = memoryBlock.accessMemory();
46 uint data = *
static_cast<uint*
> (mem);
48 return data == testNumbers[nr];
54 return memoryBlock.was_used()
55 && memoryBlock.was_closed()
56 && has_expectedContent (nr, memoryBlock);
90 uint dataID = 1 +
rani(29);
97 CHECK (
testData(dataID) == block0.accessMemory());
107 uint numElms = provider.
announce(MAX_ELMS, buffType);
109 CHECK (numElms <= MAX_ELMS);
111 for (uint i=0; i<numElms; ++i)
119 for (uint nr=0; nr<numElms; ++nr)
121 CHECK (verifyUsedBlock (nr, provider.access_emitted(nr)));
142 CHECK (!provider.access_emitted(0).was_used());
143 CHECK (!provider.access_emitted(1).was_used());
144 CHECK (!provider.access_emitted(2).was_used());
145 CHECK (!provider.access_emitted(3).was_used());
146 CHECK (!provider.access_emitted(4).was_used());
155 CHECK (0 == provider.emittedCnt());
164 CHECK (5 == provider.emittedCnt());
166 CHECK (3 == provider.
accessAs<uint>(0));
167 CHECK (1 == provider.
accessAs<uint>(1));
168 CHECK (5 == provider.
accessAs<uint>(2));
169 CHECK (4 == provider.
accessAs<uint>(3));
170 CHECK (2 == provider.
accessAs<uint>(4));
172 CHECK ( provider.access_emitted(0).was_used());
173 CHECK ( provider.access_emitted(1).was_used());
174 CHECK ( provider.access_emitted(2).was_used());
175 CHECK ( provider.access_emitted(3).was_used());
176 CHECK ( provider.access_emitted(4).was_used());
178 CHECK (!provider.access_emitted(0).was_closed());
179 CHECK (!provider.access_emitted(1).was_closed());
180 CHECK (!provider.access_emitted(2).was_closed());
181 CHECK (!provider.access_emitted(3).was_closed());
182 CHECK (!provider.access_emitted(4).was_closed());
185 CHECK (!provider.access_emitted(0).was_closed());
186 CHECK (!provider.access_emitted(1).was_closed());
187 CHECK ( provider.access_emitted(2).was_closed());
188 CHECK (!provider.access_emitted(3).was_closed());
189 CHECK (!provider.access_emitted(4).was_closed());
194 CHECK (!provider.access_emitted(0).was_closed());
195 CHECK (!provider.access_emitted(1).was_closed());
196 CHECK ( provider.access_emitted(2).was_closed());
197 CHECK (!provider.access_emitted(3).was_closed());
198 CHECK ( provider.access_emitted(4).was_closed());
207 CHECK (5 == provider.emittedCnt());
Helper for implementing a diagnostic BufferProvider: A block of heap allocated storage, with the capability to store some additional tracking information.
uint announce(uint count, BuffDescr const &)
BufferProvider API: declare in advance the need for working buffers.
Mock data frame for simulated rendering.
void releaseBuffer(BuffHandle const &)
BufferProvider API: declare done and detach.
int rani(uint bound=_iBOUND())
An opaque descriptor to identify the type and further properties of a data buffer.
Steam-Layer implementation namespace root.
BuffDescr getDescriptorFor(size_t storageSize=0)
describe the kind of buffer managed by this provider
BU & accessAs()
convenience shortcut: access the buffer contents casted to a specific type.
TY & accessAs(uint bufferID)
convenience shortcut: access the buffer with the given number, then try to convert the raw memory to ...
Simplistic test class runner.
Dummy implementation of the BufferProvider interface to support writing unit tests.
Extension to allow placing objects right into the buffers, taking ownership.
BuffHandle lockBuffer(BuffDescr const &)
BufferProvider API: retrieve a single buffer for exclusive use.
simple BufferProvider implementation with additional allocation tracking.
Lumiera error handling (C++ interface).
BuffHandle lockBufferFor(ARGS ...args)
convenience shortcut: prepare and claim ("lock") a buffer suitable to hold an object of the given typ...
Handle for a buffer for processing data, abstracting away the actual implementation.
void emitBuffer(BuffHandle const &)
BufferProvider API: state transition to emitted state.
Unit test helper to generate fake test data frames.
TestFrame & testData(uint seqNr, uint chanNr)
Helper to access a specific frame of test data at a fixed memory location.