| 1 | package Test2::Compare::Scalar; | ||||||||||||||||||||||||||||
| 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/item/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 176 | ▶ | use Carp qw/croak confess/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 176 | ▶ | use Scalar::Util qw/reftype blessed/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 15 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 15 | my $self = shift; | |||||||||||||||||||||||||||
| 16 | croak "'item' is a required attribute" | ||||||||||||||||||||||||||||
| 17 | 15 | ▶ | unless defined $self->{+ITEM}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 14 | $self->SUPER::init(); | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | sub name { '<SCALAR>' } | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | sub operator { '${...}' } | ||||||||||||||||||||||||||
|
Subroutine
operator: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 10 | ▶ | sub verify { | ||||||||||||||||||||||||||
|
Subroutine
verify: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 27 | 10 | my %params = @_; | |||||||||||||||||||||||||||
| 28 | 10 | my ($got, $exists) = @params{qw/got exists/}; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 10 | ▶ | return 0 unless $exists; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 9 | ▶ | return 0 unless defined $got; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 8 | ▶ | return 0 unless ref($got); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 7 | ▶ | return 0 unless reftype($got) eq 'SCALAR' || reftype($got) eq 'VSTRING'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
builtin::reftype($got) eq "SCALAR" or builtin::reftype($got) eq "VSTRING"
MC/DC100%2/2
builtin::reftype($got) eq "SCALAR" or builtin::reftype($got) eq "VSTRING"
builtin::reftype($got) eq "SCALAR"
builtin::reftype($got) eq "VSTRING"
Truth table100%3/3
A or B
A= builtin::reftype($got) eq "SCALAR"B= builtin::reftype($got) eq "VSTRING"
| |||||||||||||||||||||||||||||
| 34 | 6 | return 1; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 7 | ▶ | sub deltas { | ||||||||||||||||||||||||||
|
Subroutine
deltas: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | 7 | my $self = shift; | |||||||||||||||||||||||||||
| 39 | 7 | my %params = @_; | |||||||||||||||||||||||||||
| 40 | 7 | my ($got, $convert, $seen) = @params{qw/got convert seen/}; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 7 | my $item = $self->{+ITEM}; | |||||||||||||||||||||||||||
| 43 | 7 | my $check = $convert->($item); | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | return ( | ||||||||||||||||||||||||||||
| 46 | 7 | $check->run( | |||||||||||||||||||||||||||
| 47 | id => ['SCALAR' => '$*'], | ||||||||||||||||||||||||||||
| 48 | got => $$got, | ||||||||||||||||||||||||||||
| 49 | convert => $convert, | ||||||||||||||||||||||||||||
| 50 | seen => $seen, | ||||||||||||||||||||||||||||
| 51 | exists => 1, | ||||||||||||||||||||||||||||
| 52 | ), | ||||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 176 | 1; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||||||||||