line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::RandomCheck::Generator; |
2
|
4
|
|
|
4
|
|
16
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
97
|
|
3
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
104
|
|
4
|
4
|
|
|
4
|
|
13
|
use Exporter qw(import); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
103
|
|
5
|
4
|
|
|
4
|
|
1347
|
use Test::RandomCheck::ProbMonad; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
236
|
|
6
|
4
|
|
|
4
|
|
1090
|
use Test::RandomCheck::Types; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
22
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw( |
9
|
|
|
|
|
|
|
enum list integer char string concat hash_ref array_ref function |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub enum (@) { |
13
|
|
|
|
|
|
|
Test::RandomCheck::Types::Enum->new( |
14
|
|
|
|
|
|
|
items => [@_] |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub list { |
19
|
|
|
|
|
|
|
goto &Test::RandomCheck::Types::List::list; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _all_integer () { |
23
|
|
|
|
|
|
|
Test::RandomCheck::Types::AllInteger->new; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub integer (;$$) { |
27
|
|
|
|
|
|
|
goto &_all_integer if @_ == 0; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my ($min, $max) = @_ >= 2 ? @_ : (0, @_); |
30
|
|
|
|
|
|
|
($min, $max) = ($max, $min) if $min > $max; |
31
|
|
|
|
|
|
|
Test::RandomCheck::Types::Integer->new( |
32
|
|
|
|
|
|
|
min => $min, max => $max |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub char { |
37
|
|
|
|
|
|
|
goto &Test::RandomCheck::Types::Char::char; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub string (;$$) { |
41
|
|
|
|
|
|
|
my ($min, $max) = @_; |
42
|
|
|
|
|
|
|
Test::RandomCheck::Types::String->new( |
43
|
|
|
|
|
|
|
min => $min, max => $max |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub concat (@) { |
48
|
|
|
|
|
|
|
goto &Test::RandomCheck::Types::Product::product; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub hash_ref ($$;$$) { |
52
|
|
|
|
|
|
|
my ($key_type, $value_type, $min, $max) = @_; |
53
|
|
|
|
|
|
|
Test::RandomCheck::Types::HashRef->new( |
54
|
|
|
|
|
|
|
key_type => $key_type, value_type => $value_type, |
55
|
|
|
|
|
|
|
min => $min, max => $max, |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub array_ref ($;$$) { |
60
|
|
|
|
|
|
|
my ($type, $min, $max) = @_; |
61
|
|
|
|
|
|
|
Test::RandomCheck::Types::ArrayRef->new( |
62
|
|
|
|
|
|
|
min => $min, max => $max, type => $type |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub function ($$) { |
67
|
|
|
|
|
|
|
my ($dom, $cod) = @_; |
68
|
|
|
|
|
|
|
Test::RandomCheck::Types::Function->new( |
69
|
|
|
|
|
|
|
dom => $dom, cod => $cod |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
__END__ |