line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package My::Module::Test; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1953
|
use strict; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
94
|
|
7
|
1
|
|
|
1
|
|
16
|
use Exporter qw{ import }; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
81
|
|
8
|
1
|
|
|
1
|
|
789
|
use Test::More 0.88; |
|
1
|
|
|
|
|
72777
|
|
|
1
|
|
|
|
|
7
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my @export = qw{ |
11
|
|
|
|
|
|
|
decode |
12
|
|
|
|
|
|
|
fails |
13
|
|
|
|
|
|
|
hexify |
14
|
|
|
|
|
|
|
returns |
15
|
|
|
|
|
|
|
round_trip |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our @EXPORT = ( @export, @Test::More::EXPORT ); ## no critic (ProhibitAutomaticExportation) |
19
|
|
|
|
|
|
|
our @EXPORT_OK = ( @export, @Test::More::EXPORT_OK ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub decode { |
22
|
12
|
|
|
12
|
1
|
6716
|
splice @_, 1, 0, 'decode'; |
23
|
12
|
|
|
|
|
37
|
goto &returns; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub fails { ## no critic (RequireArgUnpacking) |
27
|
10
|
|
|
10
|
1
|
47
|
my ( $obj, @args ) = @_; |
28
|
|
|
|
|
|
|
## my $opt = ref $args[0] eq 'HASH' ? shift @args : {}; |
29
|
10
|
50
|
|
|
|
28
|
ref $args[0] eq 'HASH' and shift @args; # $opt is unused |
30
|
10
|
|
|
|
|
18
|
my $method = shift @args; |
31
|
10
|
|
|
|
|
12
|
my $name = pop @args; |
32
|
10
|
|
|
|
|
14
|
my $want = pop @args; |
33
|
10
|
50
|
|
|
|
20
|
ref $want or $want = qr<@{[ quotemeta $want ]}>; |
|
10
|
|
|
|
|
176
|
|
34
|
10
|
|
|
|
|
20
|
local $@; |
35
|
10
|
|
|
|
|
45
|
eval { $obj->$method( @args ); 1 } |
|
0
|
|
|
|
|
0
|
|
36
|
10
|
50
|
|
|
|
17
|
and do { |
37
|
0
|
|
|
|
|
0
|
@_ = ( "$name did not throw an exception" ); |
38
|
0
|
|
|
|
|
0
|
goto &fail; |
39
|
|
|
|
|
|
|
}; |
40
|
10
|
|
|
|
|
223
|
@_ = ( $@, $want, $name ); |
41
|
10
|
|
|
|
|
46
|
goto &like; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub hexify { |
45
|
3
|
|
|
3
|
1
|
1551
|
splice @_, 1, 0, { unpack => 'H*' }; |
46
|
3
|
|
|
|
|
9
|
goto &returns; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub returns { ## no critic (RequireArgUnpacking) |
50
|
115
|
|
|
115
|
1
|
24327
|
my ( $obj, @args ) = @_; |
51
|
115
|
100
|
|
|
|
272
|
my $opt = ref $args[0] eq 'HASH' ? shift @args : {}; |
52
|
115
|
|
|
|
|
173
|
my $method = shift @args; |
53
|
115
|
|
|
|
|
135
|
my $name = pop @args; |
54
|
115
|
|
|
|
|
146
|
my $want = pop @args; |
55
|
115
|
|
|
|
|
122
|
my $got; |
56
|
115
|
|
|
|
|
360
|
eval { $got = $obj->$method( @args ); 1 } |
|
115
|
|
|
|
|
246
|
|
57
|
115
|
50
|
|
|
|
152
|
or do { |
58
|
0
|
|
|
|
|
0
|
@_ = ( "$name threw $@" ); |
59
|
0
|
|
|
|
|
0
|
goto &fail; |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
$opt->{unpack} |
62
|
115
|
100
|
|
|
|
211
|
and $got = unpack $opt->{unpack}, $got; |
63
|
|
|
|
|
|
|
$opt->{sprintf} |
64
|
115
|
100
|
|
|
|
311
|
and $got = sprintf $opt->{sprintf}, $got; |
65
|
115
|
|
|
|
|
341
|
@_ = ( $got, $want, $name ); |
66
|
115
|
|
|
|
|
468
|
goto &is; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub round_trip { ## no critic (RequireArgUnpacking) |
70
|
41
|
|
|
41
|
1
|
22642
|
my ( $attr, $value, $opt ) = @_; |
71
|
41
|
|
100
|
|
|
183
|
$opt ||= {}; |
72
|
41
|
|
33
|
|
|
169
|
my $name = $opt->{name} || "Round-trip $attr( $value )"; |
73
|
|
|
|
|
|
|
my $utdf = eval { |
74
|
41
|
|
|
|
|
124
|
my $obj = Astro::UTDF->new( $attr => $value ); |
75
|
41
|
|
|
|
|
93
|
return Astro::UTDF->new( raw_record => $obj->raw_record() ); |
76
|
41
|
50
|
|
|
|
54
|
} or do { |
77
|
0
|
|
|
|
|
0
|
@_ = ( "$name threw $@" ); |
78
|
0
|
|
|
|
|
0
|
goto &fail; |
79
|
|
|
|
|
|
|
}; |
80
|
41
|
|
|
|
|
109
|
@_ = ( $utdf, $opt, $attr, $value, $name ); |
81
|
41
|
|
|
|
|
96
|
goto &returns; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |