| 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
| |||||||||||||
| 17 | |||||||||||||
| 18 | 262 | ▶ | $self->{+OPERATOR} ||= 'CODE(...)'; | ||||||||||
|
Condition100%2/2
$self->{"operator"} ||= "CODE(...)"
MC/DC100%1/1
$self->{"operator"} ||= "CODE(...)"
$self->{"operator"}
Truth table100%2/2
A
A= $self->{"operator"}
| |||||||||||||
| 19 | 262 | ▶ | $self->{+NAME} ||= '<Custom Code>'; | ||||||||||
|
Condition100%2/2
$self->{"name"} ||= "<Custom Code>"
MC/DC100%1/1
$self->{"name"} ||= "<Custom Code>"
$self->{"name"}
Truth table100%2/2
A
A= $self->{"name"}
| |||||||||||||
| 20 | $self->{+STRINGIFY_GOT} = $self->SUPER::stringify_got() | ||||||||||||
| 21 | 262 | ▶ | unless defined $self->{+STRINGIFY_GOT}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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__ | ||||||||||||