45 char* accessor =
reinterpret_cast<char*
> (base);
47 accessor[offset+count] = rani(CHAR_MAX);
98 CHECK (isSameObject(frame, frame.
data()));
110 CHECK (frameA == frameB);
111 CHECK (frameA != frameC);
112 CHECK (frameB != frameC);
114 CHECK (frameA.
data() == frameB.
data());
115 CHECK (frameA.
data() != frameC.
data());
116 for (
uint i=0; i<frameA.
data().size(); ++i)
117 CHECK (frameA.
data()[i] == frameB.
data()[i]);
120 CHECK (frameA.
data()[ 8] ==
char(frameA.
data64()[1]));
121 CHECK (frameA.
data()[16] ==
char(frameA.
data64()[2]));
122 CHECK (frameA.
data()[24] ==
char(frameA.
data64()[3]));
123 CHECK (frameA.
data()[32] ==
char(frameA.
data64()[4]));
124 CHECK (frameA.
data().size() == 8*frameA.
data64().size());
142 void * frameMem = &frameB;
144 CHECK (frameA == frameMem);
145 corruptMemory (frameMem,20,5);
158 CHECK (frameA != frameB);
159 CHECK (frameA != frameC);
160 CHECK (frameB == frameC);
162 corruptMemory (frameMem, 0,
sizeof(
TestFrame));
163 CHECK (not frameB.
isSane());
167 VERIFY_FAIL (
"target TestFrame already dead or unaccessible"
182 CHECK (not frame->isDead());
183 CHECK ( frame->isAlive());
184 CHECK ( frame->isValid());
189 CHECK ( frame->isValid());
190 CHECK ( frame->isSane());
201 unique_ptr<TestFrame> thisFrames[CHAN_COUNT];
202 unique_ptr<TestFrame> prevFrames[CHAN_COUNT];
204 for (
uint i=0; i<CHAN_COUNT; ++i)
205 thisFrames[i].reset (
new TestFrame(0, i));
207 for (
uint nr=1; nr<NUM_FRAMES; ++nr)
208 for (
uint i=0; i<CHAN_COUNT; ++i)
210 thisFrames[i].swap (prevFrames[i]);
211 thisFrames[i].reset (
new TestFrame(nr, i));
212 CHECK (thisFrames[i]->isPristine());
213 CHECK (prevFrames[i]->isPristine());
214 CHECK (prevFrames[i]->isAlive());
216 CHECK (*thisFrames[i] != *prevFrames[i]);
218 for (
uint j=0; j<i; ++j)
221 CHECK (*thisFrames[i] != *thisFrames[j]);
222 CHECK (*thisFrames[i] != *prevFrames[j]);
243 CHECK (isSameObject (frX, frZ));
245 corruptMemory(&frZ,40,20);
247 CHECK (not
testData(50,3).isPristine());
248 CHECK (
testData(51,3).isPristine());
249 CHECK (
testData(49,3).isPristine());
255 CHECK (
testData(50,3).isPristine());
256 CHECK (c !=
testData(49,3).data()[5]);
259 CHECK (not isSameObject(o,
testData(49,3)));
261 CHECK (o.data()[5] ==
testData(49,3).data()[5]);
void verifyFrameLifecycle()
Mock data frame for simulated rendering.
HashVal markChecksum()
recompute and store checksum based on current contents
_Arr & data()
Array-style direct access to the payload data.
static bool isAlive(void *memLocation)
Helper to verify that a given memory location holds an active TestFrame instance (created,...
static void reseed()
discard all cached testData and recalibrate data generation
Abstract Base Class for all testcases.
void seedRand()
draw a new random seed from a common nucleus, and re-seed the default-Gen.
void corruptMemory(void *base, uint offset, uint count)
TestFrame & testData(uint seqNr, uint chanNr)
Helper to access a specific frame of test data at a fixed memory location.
Steam-Layer implementation namespace root.
Test runner and basic definitions for tests.
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
A collection of frequently used helper functions to support unit testing.
#define VERIFY_FAIL(FAILURE_MSG, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises a std::exception, which additionally contains some FAI...
Unit test helper to generate fake test data frames.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...