48 const size_t TEST_ELM_SIZE =
sizeof(uint);
49 const uint MAX_ELMS = 50;
51 std::vector<uint> testNumbers(MAX_ELMS);
57 void* mem = memoryBlock.accessMemory();
58 uint data = *
static_cast<uint*
> (mem);
60 return data == testNumbers[nr];
66 return memoryBlock.was_used()
67 && memoryBlock.was_closed()
68 && has_expectedContent (nr, memoryBlock);
100 uint dataID = 1 + rand() % 29;
107 CHECK (
testData(dataID) == block0.accessMemory());
117 uint numElms = provider.
announce(MAX_ELMS, buffType);
119 CHECK (numElms <= MAX_ELMS);
121 for (uint i=0; i<numElms; ++i)
124 buff.
accessAs<uint>() = testNumbers[i] = rand() % 100000;
129 for (uint nr=0; nr<numElms; ++nr)
131 CHECK (verifyUsedBlock (nr, provider.access_emitted(nr)));
152 CHECK (!provider.access_emitted(0).was_used());
153 CHECK (!provider.access_emitted(1).was_used());
154 CHECK (!provider.access_emitted(2).was_used());
155 CHECK (!provider.access_emitted(3).was_used());
156 CHECK (!provider.access_emitted(4).was_used());
165 CHECK (0 == provider.emittedCnt());
174 CHECK (5 == provider.emittedCnt());
176 CHECK (3 == provider.
accessAs<uint>(0));
177 CHECK (1 == provider.
accessAs<uint>(1));
178 CHECK (5 == provider.
accessAs<uint>(2));
179 CHECK (4 == provider.
accessAs<uint>(3));
180 CHECK (2 == provider.
accessAs<uint>(4));
182 CHECK ( provider.access_emitted(0).was_used());
183 CHECK ( provider.access_emitted(1).was_used());
184 CHECK ( provider.access_emitted(2).was_used());
185 CHECK ( provider.access_emitted(3).was_used());
186 CHECK ( provider.access_emitted(4).was_used());
188 CHECK (!provider.access_emitted(0).was_closed());
189 CHECK (!provider.access_emitted(1).was_closed());
190 CHECK (!provider.access_emitted(2).was_closed());
191 CHECK (!provider.access_emitted(3).was_closed());
192 CHECK (!provider.access_emitted(4).was_closed());
195 CHECK (!provider.access_emitted(0).was_closed());
196 CHECK (!provider.access_emitted(1).was_closed());
197 CHECK ( provider.access_emitted(2).was_closed());
198 CHECK (!provider.access_emitted(3).was_closed());
199 CHECK (!provider.access_emitted(4).was_closed());
204 CHECK (!provider.access_emitted(0).was_closed());
205 CHECK (!provider.access_emitted(1).was_closed());
206 CHECK ( provider.access_emitted(2).was_closed());
207 CHECK (!provider.access_emitted(3).was_closed());
208 CHECK ( provider.access_emitted(4).was_closed());
217 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.
Mock data frame for simulated rendering.
void releaseBuffer(BuffHandle const &)
BufferProvider API: declare done and detach.
BuffHandle lockBufferFor()
convenience shortcut: prepare and claim ("lock") a buffer suitable to hold an object of the given typ...
TestFrame & testData(uint seqNr)
Helper to access a specific frame of test data at a fixed memory location.
Steam-Layer implementation namespace root.
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 ...
uint announce(uint count, BufferDescriptor const &)
BufferProvider API: declare in advance the need for working buffers.
Simple test class runner.
BufferDescriptor getDescriptorFor(size_t storageSize=0)
describe the kind of buffer managed by this provider
Dummy implementation of the BufferProvider interface to support writing unit tests.
An opaque descriptor to identify the type and further properties of a data buffer.
Extension to allow placing objects right into the buffers, taking ownership.
BuffHandle lockBuffer(BufferDescriptor const &)
BufferProvider API: retrieve a single buffer for exclusive use.
simple BufferProvider implementation with additional allocation tracking.
Lumiera error handling (C++ interface).
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.