| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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)
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)
| |||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 30 | ▶ | return !$isa if $negate; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 49 | 21 | return $isa; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 176 | 1; | |||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | __END__ | ||||||||||||||||||||