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....

Constructors

this
this(Random* rnd)
Undocumented in source.
this
this(Random rnd)
Undocumented in source.

Members

Aliases

Values
alias Values = staticMap!(ParameterToGen, generators)
Undocumented in source.
generators
alias generators = T[1..$]
Undocumented in source.
generators
alias generators = T
Undocumented in source.

Functions

genValues
void genValues()

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

toString
void toString(void delegate(const(char)[]) sink)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

parameterNames
string[] parameterNames;
Undocumented in source.
parameterNames
string[T.length] parameterNames;
Undocumented in source.
rnd
Random* rnd;
Undocumented in source.
values
Values values;

Ditto

Examples

auto rnd = Random(1337);
auto generator = (&rnd).RndValueGen!(["i", "f"],
                                     Gen!(int, 0, 10),
                                     Gen!(float, 0.0, 10.0));
generator.genValues();

static fun(int i, float f)
{
    import std.conv: to;
    assert(i >= 0 && i <= 10, i.to!string);
    assert(f >= 0.0 && f <= 10.0, f.to!string);
}

fun(generator.values);

Meta