40 using LERR_(LIFECYCLE);
46 const uint TEST_SIZE = 1024*1024;
47 const uint TEST_ELMS = 20;
51 do_some_calculations (
BuffHandle const& buffer)
53 UNIMPLEMENTED (
"some verifiable test/dummy buffer accessing operations");
77 verifyObjectAttachment();
78 verifyObjectAttachmentFailure();
91 CHECK (buff.isValid());
100 CHECK (!buff.isValid());
104 CHECK (checker.buffer_was_used (0));
105 CHECK (checker.buffer_was_closed (0));
107 CHECK (
testData(0) == checker.accessMemory (0));
115 // Create Test fixture. 122 CHECK (desc1.verifyValidity());
123 CHECK (desc2.verifyValidity());
125 uint num1 = provider.
announce(TEST_ELMS, desc1);
126 uint num2 = provider.
announce(TEST_ELMS, desc2);
127 CHECK (num1 == TEST_ELMS);
128 CHECK (0 < num2 && num2 <=TEST_ELMS);
131 char storage[STORAGE_SIZE];
133 BuffTable::prepare(STORAGE_SIZE, storage)
134 .announce(num1, desc1)
135 .announce(num2, desc2)
139 for_each (tab.buffers(), do_some_calculations);
140 tab.releaseBuffers();
143 CHECK (checker.all_buffers_released());
149 verifyObjectAttachment()
164 CHECK (
sizeof(
TestFrame) == handle_A.size());
165 CHECK (
sizeof(
int ) == handle_B.size());
166 CHECK (
sizeof(
int ) == handle_C.size());
169 CHECK (isSameObject (*handle_A, embeddedFrame));
170 CHECK (embeddedFrame.isAlive());
171 CHECK (embeddedFrame.isSane());
180 CHECK (embeddedFrame.isDead());
181 CHECK (embeddedFrame.isSane());
186 verifyObjectAttachmentFailure()
191 Dummy::checksum() = 0;
193 CHECK (0 == Dummy::checksum());
196 CHECK (0 < Dummy::checksum());
199 CHECK (0 == Dummy::checksum());
203 CHECK (0 == Dummy::checksum());
204 Dummy::activateCtorFailure();
206 CHECK (handle_DD.isValid());
210 NOTREACHED (
"Dummy ctor should fail");
214 CHECK (!handle_DD.isValid());
216 CHECK (0 < Dummy::checksum());
217 CHECK (val == Dummy::checksum());
Helper for unit tests: Buffer provider reference implementation.
uint announce(uint count, BuffDescr const &)
BufferProvider API: declare in advance the need for working buffers.
Mock data frame for simulated rendering.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
An opaque descriptor to identify the type and further properties of a data buffer.
static DiagnosticBufferProvider & access(BufferProvider const &)
access the diagnostic API of the buffer provider
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.
helper for organisation of render data buffers Used during the process of _"pulling"_ a render node...
BU & create()
convenience shortcut: place and maintain an object within the buffer.
BuffDescr getDescriptor(ARGS ...args)
define a "buffer type" for automatically creating an instance of the template type embedded into the ...
Simplistic test class runner.
unittest helper code: test dummy objects to track instances.
void for_each(CON const &elements, FUN function, P1 &&bind1, ARGS &&...args)
Accept binding for arbitrary function arguments.
Extension to allow placing objects right into the buffers, taking ownership.
BuffHandle lockBuffer(BuffDescr const &)
BufferProvider API: retrieve a single buffer for exclusive use.
A collection of frequently used helper functions to support unit testing.
A Dummy object for tests.
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.
A facility for writing unit-tests targeting the BufferProvider interface.
static BufferProvider & build()
build a new Diagnostic Buffer Provider instance, discard the existing one.
Interface: a facility providing and managing working buffers for media calculations.
Tables of buffer handles and corresponding dereferenced buffer pointers.
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.
Perform operations "for each element" of a collection.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...