49 using LERR_(LIFECYCLE);
55 const uint TEST_SIZE = 1024*1024;
56 const uint TEST_ELMS = 20;
60 do_some_calculations (
BuffHandle const& buffer)
62 UNIMPLEMENTED (
"some verifiable test/dummy buffer accessing operations");
86 verifyObjectAttachment();
87 verifyObjectAttachmentFailure();
100 CHECK (buff.isValid());
101 CHECK (
sizeof(
TestFrame) <= buff.size());
109 CHECK (!buff.isValid());
113 CHECK (checker.buffer_was_used (0));
114 CHECK (checker.buffer_was_closed (0));
116 CHECK (
testData(0) == checker.accessMemory (0));
124 // Create Test fixture. 131 CHECK (desc1.verifyValidity());
132 CHECK (desc2.verifyValidity());
134 uint num1 = provider.
announce(TEST_ELMS, desc1);
135 uint num2 = provider.
announce(TEST_ELMS, desc2);
136 CHECK (num1 == TEST_ELMS);
137 CHECK (0 < num2 && num2 <=TEST_ELMS);
140 char storage[STORAGE_SIZE];
142 BuffTable::prepare(STORAGE_SIZE, storage)
143 .announce(num1, desc1)
144 .announce(num2, desc2)
148 for_each (tab.buffers(), do_some_calculations);
149 tab.releaseBuffers();
152 CHECK (checker.all_buffers_released());
158 verifyObjectAttachment()
173 CHECK (
sizeof(
TestFrame) == handle_A.size());
174 CHECK (
sizeof(
int ) == handle_B.size());
175 CHECK (
sizeof(
int ) == handle_C.size());
178 CHECK (isSameObject (*handle_A, embeddedFrame));
179 CHECK (embeddedFrame.isAlive());
180 CHECK (embeddedFrame.isSane());
189 CHECK (embeddedFrame.isDead());
190 CHECK (embeddedFrame.isSane());
195 verifyObjectAttachmentFailure()
200 Dummy::checksum() = 0;
202 CHECK (0 == Dummy::checksum());
205 CHECK (0 < Dummy::checksum());
208 CHECK (0 == Dummy::checksum());
212 CHECK (0 == Dummy::checksum());
213 Dummy::activateCtorFailure();
215 CHECK (handle_DD.isValid());
219 NOTREACHED (
"Dummy ctor should fail");
223 CHECK (!handle_DD.isValid());
225 CHECK (0 < Dummy::checksum());
226 CHECK (val == Dummy::checksum());
Helper for unit tests: Buffer provider reference implementation.
Mock data frame for simulated rendering.
BuffHandle lockBufferFor()
convenience shortcut: prepare and claim ("lock") a buffer suitable to hold an object of the given typ...
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
static DiagnosticBufferProvider & access(BufferProvider const &)
access the diagnostic API of the buffer provider
TestFrame & testData(uint seqNr)
Helper to access a specific frame of test data at a fixed memory location.
Steam-Layer implementation namespace root.
unittest helper code: test dummy objects to track instances.
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.
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
An opaque descriptor to identify the type and further properties of a data buffer.
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.
A collection of frequently used helper functions to support unit testing.
A Dummy object for tests.
BuffHandle lockBuffer(BufferDescriptor const &)
BufferProvider API: retrieve a single buffer for exclusive use.
Lumiera error handling (C++ interface).
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.
Obsolete, to be rewritten /////TICKET #826.
Unit test helper to generate fake test data frames.
Perform operations "for each element" of a collection.
BufferDescriptor getDescriptor()
define a "buffer type" for automatically creating an instance of the template type embedded into the ...
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.