Branch Coverage

blib/lib/Date/EzDate.pm
Criterion Covered Total %
branch 265 360 73.6


line true false branch
62 0 81 if ($init and UNIVERSAL::isa($init, 'Date::EzDate'))
66 0 81 if (defined $init and not $init =~ /\S/s)
74 0 81 if $class->can('preprocess_time_string') and defined $init
78 0 81 unless tie %tiehash, $class . '::Tie', $init, %opts
81 0 81 if $rv->can('after_create')
112 21 0 if %{$$ob{'formats'};}
162 0 1 unless ref $right
196 0 9 if (UNIVERSAL::isa($_[0], 'Date::EzDate')) { }
207 4 10 if (UNIVERSAL::isa($arg, 'ARRAY')) { }
214 0 9 if (int @args / 2 != @args / 2) { }
226 0 9 unless (defined $start and defined $end)
230 6 3 unless ref $start
231 6 3 unless ref $end
234 0 9 if ($$start{'epoch day'} > $$end{'epoch day'})
239 8 1 if ($$start{'year'} == $$end{'year'}) { }
241 7 1 if ($$start{'monthnum'} == $$end{'monthnum'}) { }
243 2 5 if ($$start{'day of month'} == $$end{'day of month'}) { }
296 0 2 if (ref $_[0]) { }
304 0 2 if (int @_ / 2 != @_ / 2) { }
315 0 2 unless (defined $start and defined $end)
319 2 0 unless ref $start
320 2 0 unless ref $end
323 0 2 if ($$start{'epochsec'} > $$end{'epochsec'})
330 1 1 if ($$start{'ampm'} ne $$end{'ampm'})
354 8 0 unless ref $date
356 7 1 if ($current) { }
357 5 2 if ($$date{'epochday'} == $$current[1]{'epochday'} + 1) { }
373 1 0 if $current
506 0 81 defined $opts{'zero_hour_ampm'} ? :
518 21 60 if (ref $time) { }
519 0 21 unless (UNIVERSAL::isa($time, 'ARRAY'))
530 59 1 if (defined $time)
533 0 59 unless defined $time
552 0 1794 unless $$self{'settings'}{'dst_kludge'}
561 1628 166 if ($dst_adjust)
570 0 1794 unless (@timevals)
575 0 1628 if ($dst_adjust and defined $dst_before and $dst_before != $$self{'dst'})
581 0 0 if ($dst_before) { }
613 956 1597 if ($el =~ /^\{.*\}$/s)
629 0 0 defined $$self{'warnings'} ? :
631 0 0 unless $level
633 0 0 if ($level == 1)
650 11760 20 unless $_[0] =~ /^\%\w$/
690 0 1715 unless (defined $val)
694 0 1715 if $val =~ /[\{\%]/
704 36 1679 if ($key =~ /^(dayofmonth|weekdaynum|dayofweeknum|yearday)$/s) { }
3 1676 elsif ($key eq 'sec') { }
3 1673 elsif ($key eq 'min') { }
1 1672 elsif ($key eq 'minofday') { }
6 1666 elsif ($key eq 'hour') { }
3 1663 elsif ($key eq 'clocktime' or $key =~ /^mil(itary)?time$/) { }
3 1660 elsif ($key eq 'ampmhour') { }
25 1635 elsif ($key eq 'ampm' or $key eq 'ampmlc' or $key eq 'ampmuc') { }
0 1635 elsif ($key eq 'dst') { }
0 1635 elsif ($key eq 'epochsec') { }
0 1635 elsif ($key eq 'epochmin') { }
0 1635 elsif ($key eq 'epochhour') { }
1543 92 elsif ($key eq 'epochday') { }
0 92 elsif ($key =~ /dayofmonthord(word|num)?/) { }
24 68 elsif ($key eq 'year') { }
2 66 elsif ($key =~ /^year(two|2)digit/) { }
3 63 elsif ($key =~ /^monthnumbase(one|1)/) { }
31 32 elsif ($key eq 'monthnum') { }
23 9 elsif ($key eq 'monthshort' or $key eq 'monthlong') { }
5 4 elsif ($key eq 'weekdayshort' or $key eq 'weekdaylong' or $key eq 'dayofweekshort' or $key eq 'dayofweeklong') { }
3 1 elsif ($key =~ /^yeardaybase(one|1)$/) { }
1 0 elsif ($key eq 'default' or $key eq 'full' or $key eq 'dayandtime' or $key eq 'dmy') { }
706 0 36 if ($key eq 'dayofmonth' and $val > daysinmonth($$self{'monthnum'}, $$self{'year'}))
757 0 3 unless (defined $hour)
759 0 3 unless (defined $min)
761 2 1 unless (defined $sec)
780 2 1 if ($$self{'hour'} >= 12)
792 1 24 if (length $val == 1)
797 0 25 unless ($val eq 'am' or $val eq 'pm')
801 21 4 if ($$self{'hour'} < 12) { }
802 1 20 if ($val eq 'am')
805 0 4 if ($val eq 'pm')
808 4 20 if ($val eq 'am') { }
840 0 0 if ($val =~ s/^(\d+)\s*\w*$/$1/s) { }
850 0 0 unless ($nval = $Date::EzDate::Tie::OrdWordsNums{$nval})
861 0 24 if ($$self{'year'} == $val)
867 0 24 if ($$self{'dayofmonth'} > $maxday) { }
902 0 31 unless $jumps
908 23 8 if ($jumps > 0) { }
911 2 33 if ($month == 11) { }
924 2 67 if ($month == 0) { }
935 9 22 if ($dayofmonth > 28)
938 2 7 if ($dim < $dayofmonth)
973 1 0 if ($key eq 'dmy')
1001 100 9536 if (not ref $key and $key =~ /[\{\%]/ and not $key =~ /$Date::EzDate::Tie::pcode/o)
1004 115 9536 if (ref $key)
1010 434 435 if ($el =~ s/\{([^\}]+)\}/$1/ or $el =~ /$Date::EzDate::Tie::pcode/o)
1027 9109 427 unless $opts{'normalized'}
1031 5333 4203 if (exists $$self{$key})
1032 3650 1683 if ($key =~ /^(dayofmonth|monthnum|hour|min|sec)$/)
1039 190 4013 if ($key =~ s/no(zero|0)//)
1043 0 4013 if ($key =~ /^dayofmonthord(word)?$/)
1045 0 4013 if ($key eq 'dayofmonthordnum')
1049 60 3953 if ($key =~ /^(weekdayshort|dayofweekshort|dayofweek)$/)
1051 41 3912 if ($key =~ /^(weekdaylong|dayofweeklong)$/)
1053 0 3912 if ($key eq 'dayofweeknum')
1057 82 3830 if ($key eq 'monthshort')
1058 0 82 unless defined $$self{'monthnum'}
1062 21 3809 if ($key eq 'monthlong')
1064 80 3729 if ($key =~ /^monthnumbase(one|1)/)
1067 61 3668 if ($key =~ /^yeardaybase(one|1)/)
1071 60 3608 if ($key =~ /^yeartwodigit/)
1075 0 3608 if ($key eq 'epochmin')
1077 0 3608 if ($key eq 'epochhour')
1079 1589 2019 if ($key eq 'epochday')
1083 40 1979 if ($key =~ /^(is)?leapyear/)
1087 40 1939 if ($key eq 'daysinmonth')
1091 1 1938 if ($key eq 'dmy')
1095 1524 414 if ($key eq 'full')
1108 0 414 if ($key eq 'dayparam')
1116 43 371 if ($key =~ /^mil(itary)?time$/)
1120 0 371 if ($key eq 'iso8601')
1132 42 329 if ($key eq 'minofday')
1139 7 322 $$self{'hour'} >= 12 ? :
1142 74 255 if ($key eq 'ampm' or $key eq 'ampmlc')
1146 60 195 if ($key eq 'ampmuc')
1153 6 189 if ($$self{'hour'} == 0 or $$self{'hour'} == 12) { }
1 188 elsif ($$self{'hour'} > 12) { }
1161 113 82 if ($key eq 'ampmhour')
1165 22 60 if ($key eq 'clocktime' or $key eq 'clocktimestrict')
1171 22 0 if ($key eq 'clocktime')
1172 0 22 if ($minofday == 0)
1174 0 22 if ($minofday == 720)
1185 20 40 if $key eq 'newline'
1186 20 20 if $key eq 'tab'
1187 0 20 if $key eq 'leftbrace'
1188 0 20 if $key eq 'rightbrace'
1189 20 0 if $key eq 'percent'
1224 61 0 if $year % 4 == 0 and $year % 100 || $year % 400 == 0
1239 11349 960 unless ($key =~ /[\{\%]/)
1244 1737 9612 if $opts{'strip_no_zero'}
1248 943 11366 if (exists $Date::EzDate::Tie::PCodes{$key})
1252 15 11351 if (exists $$self{'formats'}{$key})
1274 3132 0 unless defined $epochsec
1279 1 3131 unless (defined $Date::EzDate::Tie::epoch_offset)
1322 59 42 if ($monthnum != 1)
1324 41 1 if (isleapyear($year))
1342 0 60 unless (defined $val)
1346 0 60 if ($val =~ /^\d+$/)
1352 60 0 if $$self{'zero_hour_ampm'}
1389 0 60 if ($val eq 'today' or $val eq 'now')
1391 0 60 if ($val eq 'tomorrow')
1393 0 60 if ($val eq 'yesterday')
1405 59 1 unless ($opts{'dateonly'})
1410 60 0 unless ($opts{'timeonly'})
1411 56 4 if (length $val)
1419 59 1 unless ($opts{'dateonly'})
1420 34 25 if (length $val and not defined $hour)
1426 0 60 if (defined $val and length $val)
1430 0 0 unless (defined $hour or defined $day or defined $month or defined $year)
1440 22 38 unless (defined $hour)
1442 22 38 unless (defined $min)
1444 27 33 unless (defined $sec)
1447 4 56 unless (defined $month)
1449 4 56 unless (defined $year)
1451 4 56 unless (defined $day)
1455 0 60 if (length $year == 2)
1465 0 60 unless (defined $rv)
1486 0 56 if ($val =~ s/^([a-z]+) (\d+) (\S+) (\d+)$/$3/) { }
2 54 elsif ($val =~ s/^(\d+) ([a-z]+) (\d+)//) { }
54 0 elsif ($val =~ s/^([a-z]+) (\d+) (\d+)//) { }
0 0 elsif ($val =~ s/^([a-z]+) (\d+)//) { }
0 0 elsif ($val =~ s/^(\d{4}) (\d+) (\d+)//) { }
0 0 elsif ($val =~ s/^(\d+) (\d+) (\d+)//) { }
1540 3 32 if ($hour == 12) { }
12 20 elsif ($ampm =~ /^p/) { }
1542 0 3 if ($ampm =~ /^a/)
1581 30 66 if ($str =~ s/^(\d+):(\d+):(\d+) (a|p)(m|\b)\s*//) { }
4 62 elsif ($str =~ s/^(\d+):(\d+):(\d+)\s*//) { }
5 57 elsif ($str =~ s/^(\d+):(\d+) (a|p)m?\s*//) { }
0 57 elsif ($str =~ s/^(\d+):(\d+)\s*//) { }
0 57 elsif ($str =~ s/^(\d+) (a|p)m?\b\s*//) { }
2 55 elsif (not $opts{'skipjustdigits'} and $str =~ /^\d+$/) { }
0 55 elsif ($opts{'croakonfail'}) { }
1641 0 4 if $day > $maxday