line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Data::Split::Backend::ValidateHash; |
2
|
|
|
|
|
|
|
$Test::Data::Split::Backend::ValidateHash::VERSION = '0.2.1'; |
3
|
2
|
|
|
2
|
|
30432
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
46
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
8
|
use Carp qw/confess/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
16
|
use parent 'Test::Data::Split::Backend::Hash'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub populate |
11
|
|
|
|
|
|
|
{ |
12
|
2
|
|
|
2
|
1
|
314
|
my ($self, $array_ref) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
6
|
my @l = @$array_ref; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
6
|
my $tests = $self->get_hash; |
17
|
|
|
|
|
|
|
|
18
|
2
|
50
|
|
|
|
10
|
if (@l & 0x1) |
19
|
|
|
|
|
|
|
{ |
20
|
0
|
|
|
|
|
0
|
confess("Input length is not even."); |
21
|
|
|
|
|
|
|
} |
22
|
2
|
|
|
|
|
9
|
while (@l) |
23
|
|
|
|
|
|
|
{ |
24
|
4
|
|
|
|
|
20
|
my $key = shift@l; |
25
|
4
|
|
|
|
|
5
|
my $val = shift@l; |
26
|
4
|
50
|
|
|
|
10
|
if (exists($tests->{$key})) |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
|
|
0
|
confess("Duplicate key '$key'!"); |
29
|
|
|
|
|
|
|
} |
30
|
4
|
|
|
|
|
13
|
$tests->{$key} = $self->validate_and_transform({id => $key, data => $val,}); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
6
|
return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |