blib/lib/Test2/Compare/Scalar.pm

filter: Statementstmt 100% 39 / 39 Branchbran 100% 10 / 10 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 98.5% 69 / 70 CC 7 SCAR 10.6
CC
7
Cov
100%
verify
6.0
init
2.0
BEGIN
1.0
CRAP 2.9
« blib/lib/Test2/Event/Ok.pm ↑ Summary blib/lib/Test2/Tools/GenTemp.pm »
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
BranchTrueFalseTotal
unless defined $self->{"item"} 1 14 15
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
BranchTrueFalseTotal
unless $exists 1 9 10
31 9 ▶ return 0 unless defined $got;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $got 1 8 9
32 8 ▶ return 0 unless ref($got);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $got 1 7 8
33 7 ▶ return 0 unless reftype($got) eq 'SCALAR' || reftype($got) eq 'VSTRING';
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::reftype($got) eq "SCALAR" or builtin::reftype($got) eq "VSTRING" 1 6 7
Condition100%3/3
builtin::reftype($got) eq "SCALAR" or builtin::reftype($got) eq "VSTRING"
l!l&&r!l&&!r
421
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"
ABresult
1X1
011
000
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__
« blib/lib/Test2/Event/Ok.pm ↑ Summary blib/lib/Test2/Tools/GenTemp.pm »