blib/lib/Test2/Compare/Custom.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 4 / 4 Conditioncond 100% 4 / 4 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 7 / 7 Podpod 50.0% 1 / 2 totaltotal 97.9% 48 / 49 CC 5 SCAR 10.4
CC
5
Cov
100%
init
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« blib/lib/Test2/Tools/GenTemp.pm ↑ Summary blib/lib/Test2/Compare/DeepRef.pm »
1 package Test2::Compare::Custom;
2 176 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 176 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 176 ▶use base 'Test2::Compare::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 176 our $VERSION = '1.302226';
8  
9 176 ▶use Test2::Util::HashBase qw/code name operator stringify_got/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 176 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 263 ▶sub init {
Subroutine init: called CC=5 SCAR=16.1
Pod undocumented
14 263 my $self = shift;
15  
16 263 ▶ croak "'code' is required" unless $self->{+CODE};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"code"} 1 262 263
17  
18 262 ▶ $self->{+OPERATOR} ||= 'CODE(...)';
Condition100%2/2
$self->{"operator"} ||= "CODE(...)"
l!l
2557
MC/DC100%1/1
$self->{"operator"} ||= "CODE(...)"
$self->{"operator"}
Truth table100%2/2
A
A= $self->{"operator"}
Aresult
11
00
19 262 ▶ $self->{+NAME} ||= '<Custom Code>';
Condition100%2/2
$self->{"name"} ||= "<Custom Code>"
l!l
2566
MC/DC100%1/1
$self->{"name"} ||= "<Custom Code>"
$self->{"name"}
Truth table100%2/2
A
A= $self->{"name"}
Aresult
11
00
20 $self->{+STRINGIFY_GOT} = $self->SUPER::stringify_got()
21 262 ▶ unless defined $self->{+STRINGIFY_GOT};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"stringify_got"} 261 1 262
22  
23 262 $self->SUPER::init();
24 }
25  
26 265 ▶sub verify {
Subroutine verify: called CC=1 SCAR=0.0
Pod documented
27 265 my $self = shift;
28 265 my %params = @_;
29 265 my ($got, $exists) = @params{qw/got exists/};
30  
31 265 my $code = $self->{+CODE};
32  
33 265 local $_ = $got;
34 my $ok = $code->(
35 got => $got,
36 exists => $exists,
37 operator => $self->{+OPERATOR},
38 265 name => $self->{+NAME},
39 );
40  
41 265 return $ok;
42 }
43  
44 176 1;
45  
46 __END__
« blib/lib/Test2/Tools/GenTemp.pm ↑ Summary blib/lib/Test2/Compare/DeepRef.pm »