File Coverage

inc/Test/Deep/Shallow.pm
Criterion Covered Total %
statement 23 26 88.4
branch 5 8 62.5
condition 5 14 35.7
subroutine 6 6 100.0
pod 0 2 0.0
total 39 56 69.6


line stmt bran cond sub pod time code
1 2     2   9 #line 1
  2         4  
  2         61  
2 2     2   10 use strict;
  2         3  
  2         61  
3             use warnings;
4              
5             package Test::Deep::Shallow;
6 2     2   10  
  2         4  
  2         11  
7             use Test::Deep::Cmp;
8 2     2   10  
  2         4  
  2         411  
9             use Scalar::Util qw( refaddr );
10              
11             sub init
12 36     36 0 41 {
13             my $self = shift;
14 36         40  
15 36         223 my $val = shift;
16             $self->{val} = $val;
17             }
18              
19             sub descend
20 36     36 0 47 {
21             my $self = shift;
22 36         43  
23 36         50 my $got = shift;
24             my $exp = $self->{val};
25 36         38  
26             my $ok;
27 36 100 66     299  
    50 25        
    50 33        
    50 25        
28             if (!defined $got and !defined $exp)
29 10         10 {
30             $ok = 1;
31             }
32             elsif (defined $got xor defined $exp)
33 0         0 {
34             $ok = 0;
35             }
36             elsif (ref $got and ref $exp)
37 0         0 {
38             $ok = refaddr($got) == refaddr($exp);
39             }
40             elsif (ref $got xor ref $exp)
41 0         0 {
42             $ok = 0;
43             }
44             else
45 26         43 {
46             $ok = $got eq $exp;
47             }
48 36         113  
49             return $ok;
50             }
51              
52             1;