20 #include "lib/hash-combine.hpp" 49 operator TestFrame* () {
return std::launder (reinterpret_cast<TestFrame* > (&storage)); }
50 TestFrame* operator->() {
return std::launder (reinterpret_cast<TestFrame* > (&storage)); }
51 TestFrame& operator* () {
return * std::launder (reinterpret_cast<TestFrame* > (&storage)); }
54 buildData (uint seq=0, uint family=0)
56 return *
new(&storage)
TestFrame{seq,family};
74 processing_generateFrame();
75 processing_generateMultichan();
76 processing_duplicateMultichan();
77 processing_manipulateMultichan();
78 processing_manipulateFrame();
79 processing_combineFrames();
81 testRand_simpleUsage();
94 CHECK (not buff->isSane());
97 CHECK ( buff->isSane());
98 CHECK ( buff->isPristine());
99 CHECK (*buff ==
TestFrame(frameNr,flavour));
111 uint channels = 1 +
rani(50);
112 CHECK (1 <= channels and channels <= 50);
115 for (uint i=0; i<channels; ++i)
116 CHECK (not buff[i]->isSane());
119 for (uint i=0; i<channels; ++i)
121 CHECK (buff[i]->isPristine());
122 CHECK (*(buff[i]) ==
TestFrame(frameNr,flavour+i));
133 uint channels = 1 +
rani(50);
138 for (uint i=0; i<channels; ++i)
139 CHECK (not clone[i]->isSane());
142 for (uint i=0; i<channels; ++i)
144 CHECK (clone[i]->isPristine());
145 CHECK (*(clone[i]) == *(srcBuff[i]));
165 uint channels = 1 +
rani(50);
166 Buffer buff[50], refData[50];
171 for (uint c=0; c<channels; ++c)
172 CHECK (buff[c]->isPristine());
177 const uint SIZ = buff[0]->data64().size();
178 vector<uint64_t> xlink(SIZ, param);
179 for (uint c=0; c<channels; ++c)
181 CHECK (buff[c]->isSane());
182 CHECK (not buff[c]->isPristine());
184 CHECK (*(buff[c]) != *(refData[c]));
186 for (
auto& [i, link] :
izip(xlink))
188 auto const& refPoint = refData[c]->data64()[i];
190 CHECK (link != refPoint);
191 CHECK (link == buff[c]->data64()[i]);
207 iBuff.buildData(frameNr,flavour);
208 oBuff.buildData(frameNr,flavour);
209 CHECK (iBuff->isPristine());
210 CHECK (oBuff->isPristine());
214 CHECK ( oBuff->isValid());
215 CHECK (not oBuff->isPristine());
216 CHECK ( iBuff->isPristine());
218 for (
auto [iDat,oDat] :
zip (iBuff->data64()
221 CHECK (oDat != iDat);
222 uint64_t feed = param;
224 CHECK (feed != param);
225 CHECK (feed != iDat);
226 CHECK (feed == oDat);
230 CHECK (not iBuff->isPristine());
231 CHECK ( iBuff->isValid());
232 CHECK (*iBuff == *oBuff);
243 Buffer i1Buff, i2Buff, oBuff;
244 i1Buff.buildData(frameNr,flavour+0);
245 i2Buff.buildData(frameNr,flavour+1);
247 CHECK (i1Buff->isPristine());
248 CHECK (i2Buff->isPristine());
249 CHECK (oBuff->isPristine());
253 CHECK ( oBuff->isValid());
254 CHECK (not oBuff->isPristine());
255 CHECK ( i1Buff->isPristine());
256 CHECK ( i2Buff->isPristine());
258 for (
auto [oDat,i1Dat,i2Dat] :
zip (oBuff->data()
261 CHECK (oDat == std::lround((1-mix)*i1Dat + mix*i2Dat));
265 CHECK (not i1Buff->isPristine());
266 CHECK ( i1Buff->isValid());
267 CHECK (*i1Buff == *oBuff);
281 auto spec =
testRand().setupGenerator();
282 SHOW_EXPR(spec.PROTO);
283 CHECK (spec.PROTO ==
"generate-TestFrame"_expect);
void manipulateMultichan(TestFrame *buffArry, uint chanCnt, uint64_t param)
»process« a planar multi channel array of data frames in-place.
void processing_generateFrame()
Mock data frame for simulated rendering.
void generateMultichan(TestFrame *buffArry, uint chanCnt, size_t frameNr, uint flavour)
produce planar multi channel output of random data frames
auto izip(ITS &&...iters)
tuple-combining iterator prefixed by index sequence
Any copy and copy construction prohibited.
void combine(size_t &combinedHash, size_t additionalHash)
meld the additional hash value into the given base hash value.
int rani(uint bound=_iBOUND())
A faked »media calculation« environment to validate the render node network.
Helpers typically used while writing tests.
void generateFrame(TestFrame *buff, size_t frameNr, uint flavour)
produce sequences of frames with (reproducible) random data
Steam-Layer implementation namespace root.
void duplicateMultichan(TestFrame *outArry, TestFrame *inArry, uint chanCnt)
create an identical clone copy of the planar multi channel frame array
Iterator builder to combine several iterables into a tuple sequence.
void manipulateFrame(TestFrame *out, TestFrame const *in, uint64_t param)
»process« random frame date by hash-chaining with a parameter.
void processing_generateMultichan()
Simplistic test class runner.
void processing_combineFrames()
uint64_t u64()
random 64bit number from full range.
A collection of frequently used helper functions to support unit testing.
void processing_manipulateFrame()
void processing_manipulateMultichan()
Generating (pseudo) random numbers with controlled seed.
void processing_duplicateMultichan()
static void reseed()
discard all cached #testData and recalibrate data generation
double uni()
random double drawn from interval [0.0 ... 1.0[
void combineFrames(TestFrame *out, TestFrame const *srcA, TestFrame const *srcB, double mix)
mix two random data frames by a parameter-controlled proportion
Random defaultGen
a global default RandomSequencer for mundane purposes
lib::Depend< TestRandOntology > testRand
Storage for the Singleton-Accessor/Factory.
uninitialised local storage that can be passed as working buffer and accessed as TestFrame ...
void testRand_simpleUsage()
auto zip(ITS &&...iters)
Build a tuple-combining iterator builder.