blib/lib/Cikl/DataTypes/Integer.pm

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 87.8% 29 / 33 CC 2 SCAR 2.7
CC
2
Cov
92%
__ANON__
2.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« blib/lib/Cikl/Models/AddressRole.pm ↑ Summary testlib/Cikl/Models/Address/TestClass.pm »
1 package Cikl::DataTypes::Integer;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Mouse::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Scalar::Util qw/looks_like_number/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 subtype "Cikl::DataTypes::Integer",
9 as 'Int',
10 7 ▶ where {
Subroutine __ANON__: called CC=2 SCAR=8.1
11 7 my $v = $_;
12 return(
13 7 ▶ (looks_like_number($v) > 1) # returns 1 if it's a string, > 1 if it is a number
Condition33%1/3
&looks_like_number($v) > 1 && $v == int $v
!ll&&!rl&&r
700
MC/DC0%0/2
&looks_like_number($v) > 1 && $v == int $v
&looks_like_number($v) > 1 $v == int $v
Truth table33%1/3
A && B
A= &looks_like_number($v) > 1B= $v == int $v
ABresult
0X0
100
111
14 && ($v == int($v))); # If it is a number, then check to see if our value
15 # is actually an integer.
16 2 };
17  
18 coerce 'Cikl::DataTypes::Integer',
19 from 'Defined',
20 5 ▶ via { int($_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
21  
22 2 1;
« blib/lib/Cikl/Models/AddressRole.pm ↑ Summary testlib/Cikl/Models/Address/TestClass.pm »