blib/lib/Test2/Compare/Isa.pm

filter: Statementstmt 100% 41 / 41 Branchbran 100% 8 / 8 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 11 / 11 Podpod 75.0% 3 / 4 totaltotal 98.5% 68 / 69 CC 6 SCAR 6.9
CC
6
Cov
100%
verify
4.0
init
2.0
operator
2.0
CRAP 2.0
« blib/lib/Test2/Manual/Tooling/Testing.pm ↑ Summary blib/lib/Test2/Tools/Exports.pm »
1 package Test2::Compare::Isa;
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 Carp qw/confess/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 176 ▶use Scalar::Util qw/blessed/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 176 ▶use base 'Test2::Compare::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 176 our $VERSION = '1.302226';
11  
12 176 ▶use Test2::Util::HashBase qw/input/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # Overloads '!' for us.
15 176 ▶use Test2::Compare::Negatable;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 10 ▶sub init {
Subroutine init: called CC=2 SCAR=6.9
Pod undocumented
18 10 my $self = shift;
19 confess "input must be defined for 'Isa' check"
20 10 ▶ unless defined $self->{+INPUT};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"input"} 1 9 10
21  
22 9 $self->SUPER::init(@_);
23 }
24  
25 7 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod documented
26 7 my $self = shift;
27 7 my $in = $self->{+INPUT};
28 7 return "$in";
29 }
30  
31 7 ▶sub operator {
Subroutine operator: called CC=2 SCAR=6.9
Pod documented
32 7 my $self = shift;
33 7 ▶ return '!isa' if $self->{+NEGATE};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"negate"} 3 4 7
34 4 return 'isa';
35 }
36  
37 33 ▶sub verify {
Subroutine verify: called CC=4 SCAR=13.9
Pod documented
38 33 my $self = shift;
39 33 my %params = @_;
40 33 my ($got, $exists) = @params{qw/got exists/};
41  
42 33 ▶ return 0 unless $exists;
Branch: 1 branch
BranchTrueFalseTotal
unless $exists 3 30 33
43  
44 30 my $input = $self->{+INPUT};
45 30 my $negate = $self->{+NEGATE};
46 30 ▶ my $isa = blessed($got) && $got->isa($input);
Condition100%3/3
builtin::blessed($got) && $got->isa($input)
!ll&&!rl&&r
71211
MC/DC100%2/2
builtin::blessed($got) && $got->isa($input)
builtin::blessed($got) $got->isa($input)
Truth table100%3/3
A && B
A= builtin::blessed($got)B= $got->isa($input)
ABresult
0X0
100
111
47  
48 30 ▶ return !$isa if $negate;
Branch: 1 branch
BranchTrueFalseTotal
if $negate 9 21 30
49 21 return $isa;
50 }
51  
52 176 1;
53  
54 __END__
« blib/lib/Test2/Manual/Tooling/Testing.pm ↑ Summary blib/lib/Test2/Tools/Exports.pm »