tts v2.3.0
The Tiny Test System
 
Loading...
Searching...
No Matches
tts::prng_generator< T, Distribution > Struct Template Reference

Wraps any standard random distribution to be used as a Data Generator by TTS_ULP_RANGE_CHECK. More...

#include <tts/test/ranges.hpp>

Detailed Description

template<typename T, typename Distribution>
struct tts::prng_generator< T, Distribution >

Wraps any standard random distribution to be used as a Data Generator by TTS_ULP_RANGE_CHECK.

Example

#define TTS_MAIN
#include <tts/tts.hpp>
#include <random>
float ok_x (float x) { return x; }
float bad_x(float x) { return x + x*1e-7f; }
TTS_CASE( "Test range check" )
{
TTS_ULP_RANGE_CHECK ( (tts::prng_generator<float, std::normal_distribution<float>>(10.f,2.f))
, float, float , ok_x, bad_x
, 2.
);
};
#define TTS_CASE(ID)
Introduces a new test scenario and registers it into the current test driver.
Definition: case.hpp:147
#define TTS_ULP_RANGE_CHECK(Producer, RefType, NewType, RefFunc, NewFunc, Ulpmax)
Generate a range based test between two functions.
Definition: ranges.hpp:274
Wraps any standard random distribution to be used as a Data Generator by TTS_ULP_RANGE_CHECK.
Definition: ranges.hpp:345
Template Parameters
TType of data to generate
DistributionStandard random distribution to adapt.