blib/lib/Test2/Compare/DeepRef.pm

filter: Statementstmt 97.8% 46 / 47 Branchbran 50.0% 6 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 75.0% 3 / 4 totaltotal 87.8% 65 / 74 CC 7 SCAR 9.9
CC
7
Cov
88%
verify
5.2
init
3.1
name
2.0
CRAP 2.7
« blib/lib/Test2/Compare/Custom.pm ↑ Summary blib/lib/Test2/Todo.pm »
1 package Test2::Compare::DeepRef;
2 174 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 174 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 174 ▶use base 'Test2::Compare::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 174 our $VERSION = '1.302226';
8  
9 174 ▶use Test2::Util::HashBase qw/input/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 174 ▶use Test2::Util::Ref qw/render_ref rtype/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 174 ▶use Scalar::Util qw/refaddr/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 174 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 ▶sub init {
Subroutine init: called CC=3 SCAR=11.4
Pod undocumented
16 4 my $self = shift;
17  
18 croak "'input' is a required attribute"
19 4 ▶ unless $self->{+INPUT};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"input"} 0 4 4
20  
21 croak "'input' must be a reference, got '" . $self->{+INPUT} . "'"
22 4 ▶ unless ref $self->{+INPUT};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self->{"input"} 0 4 4
23  
24 4 $self->SUPER::init();
25 }
26  
27 0 ▶sub name { '<REF>' }
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
28  
29 4 ▶sub verify {
Subroutine verify: called CC=5 SCAR=16.6
Pod documented
30 4 my $self = shift;
31 4 my %params = @_;
32 4 my ($got, $exists) = @params{qw/got exists/};
33  
34 4 ▶ return 0 unless $exists;
Branch: 1 branch
BranchTrueFalseTotal
unless $exists 0 4 4
35  
36 4 my $in = $self->{+INPUT};
37 4 ▶ return 0 unless ref $in;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $in 0 4 4
38 4 ▶ return 0 unless ref $got;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $got 0 4 4
39  
40 4 my $in_type = rtype($in);
41 4 my $got_type = rtype($got);
42  
43 4 ▶ return 0 unless $in_type eq $got_type;
Branch: 1 branch
BranchTrueFalseTotal
unless $in_type eq $got_type 0 4 4
44  
45 4 return 1;
46 }
47  
48 4 ▶sub deltas {
Subroutine deltas: called CC=1 SCAR=0.0
Pod documented
49 4 my $self = shift;
50 4 my %params = @_;
51 4 my ($got, $convert, $seen) = @params{qw/got convert seen/};
52  
53 4 my $in = $self->{+INPUT};
54 4 my $in_type = rtype($in);
55 4 my $got_type = rtype($got);
56
57 4 my $check = $convert->($$in);
58  
59 4 return $check->run(
60 id => ['DEREF' => '$*'],
61 convert => $convert,
62 seen => $seen,
63 got => $$got,
64 exists => 1,
65 );
66 }
67  
68  
69  
70 174 1;
71  
72 __END__
« blib/lib/Test2/Compare/Custom.pm ↑ Summary blib/lib/Test2/Todo.pm »