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

Defines a data generator that produce random value using a given distribution. More...

#include <tts/test/generator.hpp>

Detailed Description

template<typename Distribution>
struct tts::sample< Distribution >

Defines a data generator that produce random value using a given distribution.

Example

#define TTS_MAIN
#include <tts/tts.hpp>
#include <array>
TTS_CASE_WITH ( "Check behavior for interval generator"
, (std::array<float,10>)
, tts::generate(tts::sample{ std::uniform_real_distribution{-2.,2.} })
)
(auto data)
{
for(auto v : data)
TTS_EXPECT(v>=-2.f && v<2.f);
};
#define TTS_EXPECT(EXPR,...)
Check if a given expression evaluates to true.
Definition: basic.hpp:46
#define TTS_CASE_WITH(ID, TYPES, GENERATOR)
Introduces a template test case providing dynamically generated data to the test code.
Definition: case.hpp:258
auto generate(G... g)
Build a data generator.
Definition: generator.hpp:76
Defines a data generator that produce random value using a given distribution.
Definition: generator.hpp:276

Public Member Functions

 sample (Distribution d)
 Specify the distribution to use for sampling data.