NAME
Test::RandomCheck::Generator - Tools to build a generator of random values
SYNOPSIS
use Test::RandomCheck::Generator;
my $data_generator = array_ref(
hash_ref(
string() => array_ref(elements qw(True False))
), 5, 10
);
# This generator yields values like following:
# {
# 'YLkOEF' => ['True'],
# 'TwpMygm' => ['False', 'False', 'False', 'True', 'False'],
# }
DESCRIPTION
Test::RandomCheck::Generator is a combinator to build random value generators used by Test::RandomCheck.
COMBINATORS
<const 1, 2, 3;
>-
A generator which always returns specified values.
<range 1, 6;
>-
A generator which returns integer from min to max randomly.
<elements qw(true false);
>-
A generator which returns an element randomly.
<list $gen, 3, 10;
>-
A generator which returns a list of values by using specified $gen. The generated list will have length from min(e.g. 3) to max(e.g. 10).
<integer;
><char;
><string 8, 12;
>-
A generator which generates values of primitive types.
<concat $gen1, $gen2, $gen3;
>-
A generator which generates a list of values. The generated list has fixed length which is the # of generators.
<hash_ref $key_gen, $val_gen, 3, 5;
>-
A generator which returns an hash-ref. Keys are produced by $key_gen and values are produced by $val_gen; $key_gen should return one string value. On the other hand, $value_gen should return just one value, but the value doesn't have to be string. Any types of values are O.K.
<array_ref $gen, 3, 5;
>-
A generator which returns an array-ref of values by using specified $gen. The generated array-ref will have length from min(e.g. 3) to max(e.g. 5).
METHODS
SEE ALSO
AUTHOR
Masahiro Honma <hiratara@cpan.org>
COPYRIGHT
Copyright 2013- Masahiro Honma
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.