Lumiera  0.pre.03
»edit your freedom«
testframe.cpp File Reference

Go to the source code of this file.

Description

Implementation of fake data frames to support unit testing.

The data generation is based on a discriminator seed value, which is computed as a linear combination of a statically fixed anchor-seed combined with the family-number and sequence number. Based on this seed, the contents are then filled by a pseudo-random sequence.

Note
while initially drawn from real entropy, the anchor-seed can be reset from the default PRNG, which allows to establish a totally deterministically setup from test code, because the test itself can seed the default PRNG and thus establish a reproducible state.

Additionally, beyond this basic test-data feature, the contents can be manipulated freely, and a new checksum can be stored in the metadata, which allows to build pseudo media computation functions with a reproducible effect — so that the proper invocation of several computation steps invoked deep down in the render engine can be verified after completing a test invocation.

Definition in file testframe.cpp.

#include "lib/error.hpp"
#include "lib/random.hpp"
#include "lib/hash-standard.hpp"
#include "lib/hash-combine.hpp"
#include "steam/engine/testframe.hpp"
#include "lib/nocopy.hpp"
#include "lib/util.hpp"
#include <climits>
#include <memory>
#include <deque>

Classes

class  DistinctNucleus
 
struct  TestFrameTable
 

Typedefs

using PseudoRandom = lib::RandomSequencer< std::minstd_rand >
 

Functions

TestFrame & accessAsTestFrame (void *memoryLocation)
 
auto buildDataGenFrom (uint64_t const &anchor)
 
HashVal drawSeed (lib::Random &srcGen)
 
uint64_t generateDiscriminator (uint seq, uint family)
 
HashVal stampHeader ()
 
TestFrame & testData (uint seqNr=0, uint chanNr=0)
 Helper to access a specific frame of test data at a fixed memory location. More...
 

Variables

HashVal dataSeed {drawSeed(lib::entropyGen)}
 
const size_t SEQUENCE_SPREAD = 100
 Offset to set the seed values of »families« apart. More...
 
std::unique_ptr< TestFrameTable > testFrames
 

Namespaces

 steam
 Steam-Layer implementation namespace root.
 
 steam::engine
 Lumiera's render engine core and operational control.
 

Typedef Documentation

◆ PseudoRandom

using PseudoRandom = lib::RandomSequencer<std::minstd_rand>
Note
using a random-congruential engine to generate the payload data

Definition at line 57 of file testframe.cpp.

Function Documentation

◆ testData()

TestFrame & testData ( uint  seqNr = 0,
uint  chanNr = 0 
)

Helper to access a specific frame of test data at a fixed memory location.

The series of test frames is generated on demand, but remains in memory thereafter, similar to real data accessible from some kind of source stream. Each of these generated test frames is filled with different yet reproducible pseudo random data. Client code is free to access and corrupt this data.

Note
TestFrame::reseed() discards this data and draws a new base seed from defaultGen

Definition at line 186 of file testframe.cpp.

Referenced by TestFrame::data(), and TestFrame_test::useFrameTable().

+ Here is the caller graph for this function: