Test::RandomCheck::Generator - Tools to build a generator of random values
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'], # }
Test::RandomCheck::Generator is a combinator to build random value generators used by Test::RandomCheck.
<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).
Test::RandomCheck
Masahiro Honma <hiratara@cpan.org>
Copyright 2013- Masahiro Honma
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::RandomCheck, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::RandomCheck
CPAN shell
perl -MCPAN -e shell install Test::RandomCheck
For more information on module installation, please visit the detailed CPAN module installation guide.