blib/lib/FormValidator/Lite/Constraint/File.pm

filter: Statementstmt 100% 25 / 25 Branchbran 75.0% 6 / 8 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 95.4% 42 / 44 SCAR 17.9
CC
6
Cov
94%
__ANON__
5.0
__ANON__
2.0
BEGIN
1.0
CRAP 6.0
« blib/lib/FormValidator/Lite/Upload/PlackRequest.pm ↑ Summary blib/lib/FormValidator/Lite/Messages/ja.pm »
1 package FormValidator::Lite::Constraint::File;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use FormValidator::Lite::Constraint;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 file_rule 'FILE_MIME' => sub {
8 5 ▶ Carp::croak('missing args. usage: ["FILE_MIME", "text/plain"]') unless @_;
Subroutine __ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 5 5
9 5 my $expected = $_[0];
10 5 return $_->type =~ /^$expected$/;
11 3 };
12  
13 file_rule 'FILE_SIZE' => sub {
14 4 ▶ Carp::croak('missing args. usage: ["FILE_SIZE", 1_000_000, 100]') unless @_;
Subroutine __ANON__: called CC=5 SCAR=16.1
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 4 4
15  
16 4 my $size = $_->size;
17 4 my $max = shift;
18 4 my $min = shift;
19  
20 4 ▶ return 0 if $max < $size;
Branch: 1 branch
BranchTrueFalseTotal
if $max < $size 1 3 4
21 3 ▶ return 0 if defined($min) && $min > $size;
Branch: 1 branch
BranchTrueFalseTotal
if defined $min and $min > $size 1 2 3
Condition100%3/3
defined $min and $min > $size
!ll&&!rl&&r
111
MC/DC100%2/2
defined $min and $min > $size
defined $min $min > $size
Truth table100%3/3
A and B
A= defined $minB= $min > $size
ABresult
0X0
100
111
22 2 return 1;
23 3 };
24  
25 3 1;
26 __END__
« blib/lib/FormValidator/Lite/Upload/PlackRequest.pm ↑ Summary blib/lib/FormValidator/Lite/Messages/ja.pm »