Toolkit/Pattern/Range.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 2 / 2 Conditioncond 100% 11 / 11 MC/DCmcdc 100% 7 / 7 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 4 totaltotal 92.8% 52 / 56 CC 6 SCAR 10.4
CC
6
Cov
100%
match
5.0
new
2.0
BEGIN
1.0
CRAP 2.8
« Toolkit/Pattern/LastW.pm ↑ Summary Toolkit/Pattern/StepValue.pm »
1 package Cron::Toolkit::Pattern::Range;
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 21 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod undocumented
7 21 my ($class, %args) = @_;
8 21 my $self = $class->SUPER::new(%args);
9 21 ▶ $self->{wrapped} = $args{wrapped} // 0;
Condition100%2/2
$args{"wrapped"} // 0
l!l
219
MC/DC100%1/1
$args{"wrapped"} // 0
$args{"wrapped"}
Truth table100%2/2
A
A= $args{"wrapped"}
Aresult
11
00
10 21 return $self;
11 }
12  
13 1618 ▶sub type {
Subroutine type: called CC=1 SCAR=0.0
Pod undocumented
14 1618 return 'range';
15 }
16  
17 1045 ▶sub match {
Subroutine match: called CC=5 SCAR=16.1
Pod undocumented
18 1045 my ($self, $value, $tm) = @_;
19 1045 my $min = $self->{children}[0]{value};
20 1045 my $max = $self->{children}[1]{value};
21 1045 ▶ if ($self->field_type eq 'dow' && $self->{wrapped}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->field_type eq "dow" and $self->{"wrapped"}) 21 1024 1045
Condition100%3/3
$self->field_type eq "dow" and $self->{"wrapped"}
!ll&&!rl&&r
10061821
MC/DC100%2/2
$self->field_type eq "dow" and $self->{"wrapped"}
$self->field_type eq "dow" $self->{"wrapped"}
Truth table100%3/3
A and B
A= $self->field_type eq "dow"B= $self->{"wrapped"}
ABresult
0X0
100
111
22 # Wrapped range: e.g. 6-2 = 6,7,1,2
23 21 ▶ return $value >= $min || $value <= $max;
Condition100%3/3
$value >= $min || $value <= $max
l!l&&r!l&&!r
4512
MC/DC100%2/2
$value >= $min || $value <= $max
$value >= $min $value <= $max
Truth table100%3/3
A || B
A= $value >= $minB= $value <= $max
ABresult
1X1
011
000
24 }
25 1024 ▶ return $value >= $min && $value <= $max;
Condition100%3/3
$value >= $min && $value <= $max
!ll&&!rl&&r
219457348
MC/DC100%2/2
$value >= $min && $value <= $max
$value >= $min $value <= $max
Truth table100%3/3
A && B
A= $value >= $minB= $value <= $max
ABresult
0X0
100
111
26 }
27  
28 17 ▶sub to_english {
Subroutine to_english: called CC=1 SCAR=0.0
Pod undocumented
29 17 my ($self) = @_;
30 17 my $from = $self->{children}[0]->english_value;
31 17 my $to = $self->{children}[1]->english_value;
32 17 return "every " . $self->english_unit . " from $from to $to";
33 }
34  
35 2 1;
« Toolkit/Pattern/LastW.pm ↑ Summary Toolkit/Pattern/StepValue.pm »