Branch Coverage

blib/lib/Date/HolidayParser.pm
Criterion Covered Total %
branch 111 180 61.6


line true false branch
59 0 56 if (not defined $Year) { }
0 56 elsif ($Year =~ /\D/) { }
0 56 elsif ($Year < 1971 or $Year > 2037) { }
74 5 51 unless ($self->_cache->{$Year})
116 15 0 if ($number > 31) { }
134 6 0 if (defined $file)
145 0 6 if (not $self->file) { }
0 6 elsif (not -e $self->file) { }
174 15 35 if (defined $ADD_DAYS)
178 5 45 if (defined $SUBTRACT_DAYS)
197 0 95 unless defined $PosixTime
217 0 35 if $Unix_Time =~ /\D/
243 0 0 if ($BeSilent and not $self->silent) { }
0 0 elsif (not $self->silent) { }
284 15 35 if (defined $CreativeParser->{'AddEaster'})
288 10 40 if (defined $CreativeParser->{'MonthDay'})
298 0 50 unless (defined $CreativeParser->{'IsMonth'} or defined $NumericYDay)
304 20 30 if (defined $CreativeParser->{'MustBeDay'}) { }
5 25 elsif (defined $CreativeParser->{'IsMonth'}) { }
25 0 elsif (defined $NumericYDay) { }
309 15 5 if (defined $CreativeParser->{'IsMonth'} and defined $CreativeParser->{'Number'}) { }
5 0 elsif (defined $CreativeParser->{'IsMonth'} and defined $CreativeParser->{'DateNumeric'}) { }
0 0 elsif (defined $CreativeParser->{'IsMonth'}) { }
313 0 15 unless (defined $CreativeParser->{'Number'})
318 5 10 if ($CreativeParser->{'Number'} eq 'last') { }
323 5 10 if (_Holiday_DayName($proper_yday, $Year) eq $CreativeParser->{'MustBeDay'})
334 25 0 if (_Holiday_DayName($proper_yday, $Year) eq $CreativeParser->{'MustBeDay'})
342 5 20 unless ($detect_mon eq $MonthMapping{$CreativeParser->{'IsMonth'}})
355 5 5 if ($CreativeParser->{'Number'} eq 'first') { }
5 0 elsif ($CreativeParser->{'Number'} eq 'second') { }
0 0 elsif ($CreativeParser->{'Number'} eq 'third') { }
0 0 elsif ($CreativeParser->{'Number'} eq 'fourth') { }
376 0 0 unless $CreativeParser->{'Number'} eq 'null'
392 20 0 if (defined $NumericYDay) { }
396 0 20 unless (defined $CreativeParser->{'BeforeOrAfter'})
401 10 10 if ($CreativeParser->{'BeforeOrAfter'} eq 'before') { }
10 0 elsif ($CreativeParser->{'BeforeOrAfter'} eq 'after') { }
407 10 5 if (_Holiday_DayName($FinalYDay, $Year) eq $CreativeParser->{'MustBeDay'})
420 10 30 if (_Holiday_DayName($FinalYDay, $Year) eq $CreativeParser->{'MustBeDay'})
442 0 5 unless (defined $CreativeParser->{'DateNumeric'})
455 0 25 if (defined $CreativeParser->{'MustBeDay'})
464 0 50 if (defined $CreativeParser->{'Every'} and not defined $CreativeParser->{'Number'})
468 0 50 if (defined $CreativeParser->{'Every'} and defined $CreativeParser->{'Length'})
473 50 0 if (defined $FinalYDay and $FinalYDay =~ /^\d+$/) { }
0 0 elsif (defined $FinalYDay) { }
477 55 0 if (defined $FinalYDay)
483 5 50 if (defined $CreativeParser->{'Every'} and defined $CreativeParser->{'Number'}) { }
0 50 elsif (defined $CreativeParser->{'Length'} and $CreativeParser->{'Length'} > 0) { }
486 0 5 if ($CreativeParser->{'Number'} ne 'second') { }
498 0 0 unless $CreativeParser->{'Length'}--
526 0 6 unless -e $File
527 0 6 unless -r $File
529 0 6 unless open my $HolidayFile, '<', $File
534 72 60 if $Line =~ /^\s*[:;#]/
535 0 60 if $Line =~ /^\s*$/
548 42 18 if ($Line =~ /^\s*\"/) { }
558 18 42 if ($LineMode eq 'PreDec')
566 18 0 if (length $PreDec) { }
573 18 0 if ($PreDec =~ /^(weekend|red)$/) { }
0 0 elsif ($PreDec =~ /^(black|small|blue|green|cyan|magenta|yellow)$/) { }
601 0 60 if ($HolidayName =~ /^\"*$/)
607 6 54 if ($Line =~ /^\s*(weekend|red|black|small|blue|green|cyan|magenta|yellow)/)
614 6 0 if ($HolidayDec =~ /^(weekend|red)$/) { }
0 0 elsif ($HolidayDec =~ /^(black|small|blue|green|cyan|magenta|yellow)$/) { }
621 0 0 unless (defined $HolidayType and $HolidayType eq 'red')
632 60 0 if ($Line =~ /^\s*on/) { }
650 54 258 if /^\s*$/
651 18 240 if (/^(last|first|second|third|fourth)$/) { }
24 216 elsif (/^(monday|tuesday|wednesday|thursday|friday|saturday|sunday)$/) { }
12 204 elsif (m[^\d+[/\.]\d+\.?$]) { }
30 174 elsif (/^(january|february|march|april|may|june|july|august|september|october|november|december)$/) { }
12 162 elsif (/^plus$/) { }
6 156 elsif (/^minus$/) { }
0 156 elsif (/^length$/) { }
18 138 elsif (/^easter$/) { }
0 138 elsif (/^weekend$/) { }
30 108 elsif (/^\d+$/) { }
6 102 elsif (/^(before|after)$/) { }
6 96 elsif (/^every$/) { }
96 0 elsif (/^(in|on|days|day)$/) { }
667 6 6 if (/^\d+\.\d+$/) { }
6 0 elsif (m[^\d+/\d+$]) { }
706 0 30 if $_ > 365
708 12 18 unless (defined $CreativeParser{'NextIs'} and $CreativeParser{'NextIs'})
715 12 6 if ($CreativeParser{'NextIs'} eq 'add') { }
6 0 elsif ($CreativeParser{'NextIs'} eq 'sub') { }
0 0 elsif ($CreativeParser{'NextIs'} eq 'length') { }
717 0 12 if (defined $CreativeParser{'AddDays'}) { }
729 0 6 if (defined $CreativeParser{'SubtDays'}) { }
741 0 0 if (defined $CreativeParser{'Length'}) { }