Branch Coverage

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


line true false branch
61 0 81 if ($init and UNIVERSAL::isa($init, 'Date::EzDate'))
65 0 81 if (defined $init and not $init =~ /\S/s)
73 0 81 if $class->can('preprocess_time_string') and defined $init
77 0 81 unless tie %tiehash, $class . '::Tie', $init, %opts
80 0 81 if $rv->can('after_create')
111 21 0 if %{$$ob{'formats'};}
161 0 1 unless ref $right
195 0 9 if (UNIVERSAL::isa($_[0], 'Date::EzDate')) { }
206 4 10 if (UNIVERSAL::isa($arg, 'ARRAY')) { }
213 0 9 if (int @args / 2 != @args / 2) { }
225 0 9 unless (defined $start and defined $end)
229 6 3 unless ref $start
230 6 3 unless ref $end
233 0 9 if ($$start{'epoch day'} > $$end{'epoch day'})
238 8 1 if ($$start{'year'} == $$end{'year'}) { }
240 7 1 if ($$start{'monthnum'} == $$end{'monthnum'}) { }
242 2 5 if ($$start{'day of month'} == $$end{'day of month'}) { }
295 0 2 if (ref $_[0]) { }
303 0 2 if (int @_ / 2 != @_ / 2) { }
314 0 2 unless (defined $start and defined $end)
318 2 0 unless ref $start
319 2 0 unless ref $end
322 0 2 if ($$start{'epochsec'} > $$end{'epochsec'})
329 1 1 if ($$start{'ampm'} ne $$end{'ampm'})
353 8 0 unless ref $date
355 7 1 if ($current) { }
356 5 2 if ($$date{'epochday'} == $$current[1]{'epochday'} + 1) { }
372 1 0 if $current
505 0 81 defined $opts{'zero_hour_ampm'} ? :
517 21 60 if (ref $time) { }
518 0 21 unless (UNIVERSAL::isa($time, 'ARRAY'))
529 59 1 if (defined $time)
532 0 59 unless defined $time
551 0 1794 unless $$self{'settings'}{'dst_kludge'}
560 1628 166 if ($dst_adjust)
569 0 1794 unless (@timevals)
574 0 1628 if ($dst_adjust and defined $dst_before and $dst_before != $$self{'dst'})
580 0 0 if ($dst_before) { }
612 956 1597 if ($el =~ /^\{.*\}$/s)
628 0 0 defined $$self{'warnings'} ? :
630 0 0 unless $level
632 0 0 if ($level == 1)
649 11760 20 unless $_[0] =~ /^\%\w$/
689 0 1715 unless (defined $val)
693 0 1715 if $val =~ /[\{\%]/
703 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') { }
705 0 36 if ($key eq 'dayofmonth' and $val > daysinmonth($$self{'monthnum'}, $$self{'year'}))
756 0 3 unless (defined $hour)
758 0 3 unless (defined $min)
760 2 1 unless (defined $sec)
779 2 1 if ($$self{'hour'} >= 12)
791 1 24 if (length $val == 1)
796 0 25 unless ($val eq 'am' or $val eq 'pm')
800 21 4 if ($$self{'hour'} < 12) { }
801 1 20 if ($val eq 'am')
804 0 4 if ($val eq 'pm')
807 4 20 if ($val eq 'am') { }
839 0 0 if ($val =~ s/^(\d+)\s*\w*$/$1/s) { }
849 0 0 unless ($nval = $Date::EzDate::Tie::OrdWordsNums{$nval})
860 0 24 if ($$self{'year'} == $val)
866 0 24 if ($$self{'dayofmonth'} > $maxday) { }
901 0 31 unless $jumps
907 23 8 if ($jumps > 0) { }
910 2 33 if ($month == 11) { }
923 2 67 if ($month == 0) { }
934 9 22 if ($dayofmonth > 28)
937 2 7 if ($dim < $dayofmonth)
972 1 0 if ($key eq 'dmy')
1000 100 9536 if (not ref $key and $key =~ /[\{\%]/ and not $key =~ /$Date::EzDate::Tie::pcode/o)
1003 115 9536 if (ref $key)
1009 434 435 if ($el =~ s/\{([^\}]+)\}/$1/ or $el =~ /$Date::EzDate::Tie::pcode/o)
1026 9109 427 unless $opts{'normalized'}
1030 5333 4203 if (exists $$self{$key})
1031 3650 1683 if ($key =~ /^(dayofmonth|monthnum|hour|min|sec)$/)
1038 190 4013 if ($key =~ s/no(zero|0)//)
1042 0 4013 if ($key =~ /^dayofmonthord(word)?$/)
1044 0 4013 if ($key eq 'dayofmonthordnum')
1048 60 3953 if ($key =~ /^(weekdayshort|dayofweekshort|dayofweek)$/)
1050 41 3912 if ($key =~ /^(weekdaylong|dayofweeklong)$/)
1052 0 3912 if ($key eq 'dayofweeknum')
1056 82 3830 if ($key eq 'monthshort')
1057 0 82 unless defined $$self{'monthnum'}
1061 21 3809 if ($key eq 'monthlong')
1063 80 3729 if ($key =~ /^monthnumbase(one|1)/)
1066 61 3668 if ($key =~ /^yeardaybase(one|1)/)
1070 60 3608 if ($key =~ /^yeartwodigit/)
1074 0 3608 if ($key eq 'epochmin')
1076 0 3608 if ($key eq 'epochhour')
1078 1589 2019 if ($key eq 'epochday')
1082 40 1979 if ($key =~ /^(is)?leapyear/)
1086 40 1939 if ($key eq 'daysinmonth')
1090 1 1938 if ($key eq 'dmy')
1094 1524 414 if ($key eq 'full')
1107 0 414 if ($key eq 'dayparam')
1115 43 371 if ($key =~ /^mil(itary)?time$/)
1119 0 371 if ($key eq 'iso8601')
1131 42 329 if ($key eq 'minofday')
1138 7 322 $$self{'hour'} >= 12 ? :
1141 74 255 if ($key eq 'ampm' or $key eq 'ampmlc')
1145 60 195 if ($key eq 'ampmuc')
1152 4 191 if ($$self{'hour'} == 0 or $$self{'hour'} == 12) { }
1 190 elsif ($$self{'hour'} > 12) { }
1160 113 82 if ($key eq 'ampmhour')
1164 22 60 if ($key eq 'clocktime' or $key eq 'clocktimestrict')
1170 22 0 if ($key eq 'clocktime')
1171 0 22 if ($minofday == 0)
1173 0 22 if ($minofday == 720)
1184 20 40 if $key eq 'newline'
1185 20 20 if $key eq 'tab'
1186 0 20 if $key eq 'leftbrace'
1187 0 20 if $key eq 'rightbrace'
1188 20 0 if $key eq 'percent'
1223 61 0 if $year % 4 == 0 and $year % 100 || $year % 400 == 0
1238 11349 960 unless ($key =~ /[\{\%]/)
1243 1737 9612 if $opts{'strip_no_zero'}
1247 943 11366 if (exists $Date::EzDate::Tie::PCodes{$key})
1251 15 11351 if (exists $$self{'formats'}{$key})
1273 3132 0 unless defined $epochsec
1278 1 3131 unless (defined $Date::EzDate::Tie::epoch_offset)
1321 59 42 if ($monthnum != 1)
1323 41 1 if (isleapyear($year))
1341 0 60 unless (defined $val)
1345 0 60 if ($val =~ /^\d+$/)
1351 60 0 if $$self{'zero_hour_ampm'}
1388 0 60 if ($val eq 'today' or $val eq 'now')
1390 0 60 if ($val eq 'tomorrow')
1392 0 60 if ($val eq 'yesterday')
1404 59 1 unless ($opts{'dateonly'})
1409 60 0 unless ($opts{'timeonly'})
1410 56 4 if (length $val)
1418 59 1 unless ($opts{'dateonly'})
1419 34 25 if (length $val and not defined $hour)
1425 0 60 if (defined $val and length $val)
1429 0 0 unless (defined $hour or defined $day or defined $month or defined $year)
1439 22 38 unless (defined $hour)
1441 22 38 unless (defined $min)
1443 27 33 unless (defined $sec)
1446 4 56 unless (defined $month)
1448 4 56 unless (defined $year)
1450 4 56 unless (defined $day)
1454 0 60 if (length $year == 2)
1464 0 60 unless (defined $rv)
1485 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+)//) { }
1539 3 32 if ($hour == 12) { }
12 20 elsif ($ampm =~ /^p/) { }
1541 0 3 if ($ampm =~ /^a/)
1580 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'}) { }
1640 0 4 if $day > $maxday