Lumiera  0.pre.03
»edit your freedom«
RandomDraw_test Class Reference

Description

Test:
Verify a flexible builder for random-value generators; using a config template, these can be outfitted to use a suitable source of randomness and to produce values from a desired target type and limited range.
  • for this test, generated result values are ∈ [-2 .. 0 .. +2]
  • no actual randomness is used; rather a size_t challenge is sent in to verify precisely deterministic numeric results.
    See also
    random-draw.hpp
    vault::gear::TestChainLoad as usage example
    SchedulerStress_test

Definition at line 122 of file random-draw-test.cpp.

Private Member Functions

void run (Arg)
 
void simpleUse ()
 
void verify_adaptMapping ()
 
void verify_dynamicChange ()
 
void verify_numerics ()
 
void verify_policy ()
 

Member Function Documentation

◆ simpleUse()

void simpleUse ( )
inlineprivate
Test:
demonstrate a basic usage scenario

Definition at line 142 of file random-draw-test.cpp.

◆ verify_policy()

void verify_policy ( )
inlineprivate
Test:
verify configuration through policy template
  • use the default policy, which takes no input values, but rather directly generates a random number; in this case here, input values are ∈ [0 .

. 5]

  • define another policy template, to produce char values, while always requiring two input data values (char,uint); moreover, define the defaultSrc() directly to produce the raw mapping values (double) using a custom formula; the resulting RandomDraw instance is now a function with two input arguments, producing char values.

Definition at line 174 of file random-draw-test.cpp.

◆ verify_numerics()

void verify_numerics ( )
inlineprivate
Test:
verify random number transformations.
  • use a Draw instance with result values [-2..0..+2]
  • values are evenly distributed within limits of quantisation
  • the probability parameter controls the amount of neutral results
  • maximum and minimum value settings will be respected
  • the interval [min..max] is independent from neutral value
  • probability defines the cases within [min..max] \ neutral
  • all other cases q = 1 - p will yield the neutral value
  • implausible max/min settings will be corrected automatically

Definition at line 206 of file random-draw-test.cpp.

◆ verify_adaptMapping()

void verify_adaptMapping ( )
inlineprivate
Test:
bind custom mapping transformation functions.
  • use different translation into positional values as input for the actual result value mapping;
  • use a mapping function with different arguments, which is wired by the appropriate Adapter from the Policy;
  • moreover, the concrete Policy may tap into the context, which is demonstrated here by accessing a global variable. In practice, this capability allows to accept custom types as data source.

Definition at line 618 of file random-draw-test.cpp.

◆ verify_dynamicChange()

void verify_dynamicChange ( )
inlineprivate
Test:
change the generation profile dynamically, based on current input; in the example here, the probability is manipulated in each cycle.

Definition at line 752 of file random-draw-test.cpp.

+ Inheritance diagram for RandomDraw_test:
+ Collaboration diagram for RandomDraw_test:

The documentation for this class was generated from the following file: