line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::RandomCheck::Types::Product; |
2
|
4
|
|
|
4
|
|
13
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
88
|
|
3
|
4
|
|
|
4
|
|
12
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
79
|
|
4
|
4
|
|
|
4
|
|
12
|
use parent "Test::RandomCheck::Types"; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
22
|
|
5
|
4
|
|
|
4
|
|
208
|
use Class::Accessor::Lite (ro => [qw(types)]); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
21
|
|
6
|
4
|
|
|
4
|
|
244
|
use Exporter qw(import); |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
91
|
|
7
|
4
|
|
|
4
|
|
15
|
use Test::RandomCheck::Types::AllInteger; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
28
|
|
8
|
4
|
|
|
4
|
|
12
|
use Test::RandomCheck::ProbMonad; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
864
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw(product); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub product (@) { |
13
|
0
|
|
|
0
|
0
|
|
Test::RandomCheck::Types::Product->new( |
14
|
|
|
|
|
|
|
types => [@_] |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub arbitrary { |
19
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
20
|
|
|
|
|
|
|
gen { |
21
|
0
|
|
|
0
|
|
|
my ($rand, $size) = @_; |
22
|
0
|
|
|
|
|
|
map { $_->arbitrary->pick($rand, $size) } @{$self->types}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub memoize_key { |
27
|
0
|
|
|
0
|
0
|
|
my ($self, @xs) = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my @keys; |
30
|
0
|
|
|
|
|
|
for my $i (1 .. $#{$self->types}) { |
|
0
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
push @keys, $self->types->[$i]->memoize_key($xs[$i]); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
join '\0', @keys; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |