RndValueGen

This type will generate a Gen!T for all passed T.... Every call to genValues will call gen of all Gen structs present in values. The member values can be passed to every function accepting T....

struct RndValueGen (
T...
) {
string[] parameterNames;
string[T.length] parameterNames;
Random* rnd;
}

Members

Functions

genValues
void genValues()

A call to this member function will call gen on all items in values passing the provided random number generator

Variables

values
Values values;

Ditto

Examples

1 import unit_threaded.randomized.gen: Gen;
2 import std.random: Random;
3 
4 auto rnd = Random(1337);
5 auto generator = (&rnd).RndValueGen!(["i", "f"],
6                                      Gen!(int, 0, 10),
7                                      Gen!(float, 0.0, 10.0));
8 generator.genValues();
9 
10 static fun(int i, float f)
11 {
12     import std.conv: to;
13     assert(i >= 0 && i <= 10, i.to!string);
14     assert(f >= 0.0 && f <= 10.0, f.to!string);
15 }
16 
17 fun(generator.values);

Meta