Toolkit/Pattern/LastW.pm

filter: Statementstmt 91.3% 21 / 23 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 74.4% 32 / 43 CC 5 SCAR 12.1
CC
5
Cov
81%
match
5.7
BEGIN
1.0
BEGIN
1.0
CRAP 3.3
« Toolkit/Pattern/Last.pm ↑ Summary Toolkit/Pattern/Range.pm »
1 package Cron::Toolkit::Pattern::LastW;
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 parent 'Cron::Toolkit::Pattern';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 41 ▶sub type {
Subroutine type: called CC=1 SCAR=0.0
Pod undocumented
7 41 return 'lastW';
8 }
9  
10 32 ▶sub match {
Subroutine match: called CC=5 SCAR=17.4
Pod undocumented
11 32 my ($self, $value, $tm) = @_;
12 32 my $dom = $tm->day_of_month;
13 32 my $days_in_month = $tm->length_of_month;
14 32 my $candidate = $days_in_month;
15 32 ▶ while ( $candidate >= 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($candidate >= 1) 32 0 32
16 32 my $test_tm = $tm->with_day_of_month($candidate);
17 32 my $test_dow = $test_tm->day_of_week;
18 32 ▶ if ( $test_dow >= 1 && $test_dow <= 5 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test_dow >= 1 and $test_dow <= 5) 32 0 32
Condition33%1/3
$test_dow >= 1 and $test_dow <= 5
!ll&&!rl&&r
0032
MC/DC0%0/2
$test_dow >= 1 and $test_dow <= 5
$test_dow >= 1 $test_dow <= 5
Truth table33%1/3
A and B
A= $test_dow >= 1B= $test_dow <= 5
ABresult
0X0
100
111
19 32 ▶ return $dom == $candidate ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$dom == $candidate ? : 2 30 32
20 }
21 0 $candidate--;
22 }
23 0 return 0;
24 }
25  
26 1 ▶sub to_english {
Subroutine to_english: called CC=1 SCAR=0.0
Pod undocumented
27 1 return 'on the last weekday';
28 }
29  
30 2 1;
« Toolkit/Pattern/Last.pm ↑ Summary Toolkit/Pattern/Range.pm »