line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Compare::Value; |
2
|
100
|
|
|
100
|
|
651
|
use strict; |
|
100
|
|
|
|
|
126
|
|
|
100
|
|
|
|
|
2238
|
|
3
|
100
|
|
|
100
|
|
297
|
use warnings; |
|
100
|
|
|
|
|
116
|
|
|
100
|
|
|
|
|
2019
|
|
4
|
|
|
|
|
|
|
|
5
|
100
|
|
|
100
|
|
289
|
use Scalar::Util qw/looks_like_number/; |
|
100
|
|
|
|
|
127
|
|
|
100
|
|
|
|
|
3721
|
|
6
|
|
|
|
|
|
|
|
7
|
100
|
|
|
100
|
|
321
|
use Carp qw/carp/; |
|
100
|
|
|
|
|
112
|
|
|
100
|
|
|
|
|
3364
|
|
8
|
|
|
|
|
|
|
|
9
|
100
|
|
|
100
|
|
340
|
use base 'Test::Stream::Compare'; |
|
100
|
|
|
|
|
113
|
|
|
100
|
|
|
|
|
6073
|
|
10
|
100
|
|
|
100
|
|
377
|
use Test::Stream::HashBase accessors => [qw/input/]; |
|
100
|
|
|
|
|
123
|
|
|
100
|
|
|
|
|
581
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub init { |
13
|
5
|
|
|
5
|
0
|
5
|
my $self = shift; |
14
|
5
|
|
|
|
|
410
|
carp "Test::Stream::Compare::Value is considered deprecated and dangerous"; |
15
|
5
|
|
|
|
|
18
|
$self->SUPER::init(@_); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub name { |
19
|
5
|
|
|
5
|
1
|
14
|
my $self = shift; |
20
|
5
|
|
|
|
|
7
|
my $in = $self->{+INPUT}; |
21
|
5
|
100
|
|
|
|
14
|
return '' unless defined $in; |
22
|
4
|
|
|
|
|
11
|
return "$in"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub operator { |
26
|
35
|
|
|
35
|
1
|
35
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
35
|
100
|
|
|
|
57
|
return '' unless @_; |
29
|
|
|
|
|
|
|
|
30
|
30
|
|
|
|
|
28
|
my ($got) = @_; |
31
|
30
|
|
|
|
|
25
|
my $input = $self->{+INPUT}; |
32
|
|
|
|
|
|
|
|
33
|
30
|
100
|
100
|
|
|
120
|
return '' if defined($input) xor defined($got); |
34
|
24
|
100
|
66
|
|
|
64
|
return '==' unless defined($input) && defined($got); |
35
|
23
|
100
|
100
|
|
|
98
|
return '==' if looks_like_number($got) && looks_like_number($input); |
36
|
14
|
|
|
|
|
27
|
return 'eq'; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub verify { |
40
|
32
|
|
|
32
|
1
|
36
|
my $self = shift; |
41
|
32
|
|
|
|
|
52
|
my %params = @_; |
42
|
32
|
|
|
|
|
46
|
my ($got, $exists) = @params{qw/got exists/}; |
43
|
|
|
|
|
|
|
|
44
|
32
|
100
|
|
|
|
57
|
return 0 unless $exists; |
45
|
27
|
100
|
|
|
|
53
|
return 0 if ref $got; |
46
|
|
|
|
|
|
|
|
47
|
22
|
|
|
|
|
19
|
my $input = $self->{+INPUT}; |
48
|
22
|
100
|
|
|
|
44
|
return !defined($got) unless defined $input; |
49
|
19
|
100
|
|
|
|
38
|
return 0 unless defined($got); |
50
|
|
|
|
|
|
|
|
51
|
15
|
|
|
|
|
18
|
my $op = $self->operator($got); |
52
|
|
|
|
|
|
|
|
53
|
15
|
100
|
|
|
|
48
|
return $input == $got if $op eq '=='; |
54
|
8
|
|
|
|
|
28
|
return $input eq $got; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |