Branch Coverage

lib/Date/Manip/Base.pm
Criterion Covered Total %
branch 477 592 80.5


line true false branch
54 0 505 if exists $self->{'cache'}{'init'}
71 1 505 if exists $self->{'data'}{'calc'} and not $force
81 0 506 if exists $self->{'data'}{'sections'}{'conf'} and not $force
239 1026 520 unless $beg
240 1026 520 unless $end
280 0 519 if exists $self->{'data'}{'events'} and not $force
315 0 523 if exists $self->{'data'}{'holidays'} and not $force
370 0 1044 if exists $self->{'data'}{'lang'} and not $force
390 7664 4729 if (ref $arg) { }
401 6 4723 if ($ddd < 0)
423 1443 9179 if $dow == 0
429 1369 2424 if $y % 4 == 0 and $y % 100 != 0 or $y % 400 == 0
436 114 266 $self->leapyear($y) ? :
444 2 37202 if (not $m) { }
2904 34298 elsif ($m == 2) { }
445 1 1 if $self->leapyear($y)
468 265 433 if (@args == 2) { }
474 9 256 if $tmp =~ /\./
480 265 800 if $n <= $doy_days[$ly][$m]
483 256 9 unless $time
490 4 5 if "$s" ne int $s
499 238 195 $m > 2 ? :
502 430 3 unless defined $h
516 913 84 $m ? :
524 913 84 if ($m) { }
526 8 905 $n < 0 ? :
530 0 84 $n < 0 ? :
531 0 84 if ($n < 0) { }
543 550 447 if ($dow < $ddow) { }
548 8 989 if $d > $max
552 847 150 if ($n > 1) { }
2 148 elsif ($n < -1) { }
554 0 847 if $d > $max
557 0 2 if $d < 1
562 913 84 if ($m)
579 2555 5 if (ref $arg) { }
606 7 15354 if not $self->check_time([$h, $mn, $s]) or $y < 1 or $y > 9999 or $m < 1 or $m > 12
612 4 15350 if $d < 1 or $d > $days
620 3 1 if not +("${h}:${mn}:$s") =~ /^\d\d?:\d\d?:\d\d?$/o or $h > 24 or $mn > 59 or $s > 59 or $h == 24 and $mn || $s
635 419 981 if exists $self->{'cache'}{'week1day1'}{$firstday}{$week1ofyear}{$year}
641 581 400 if ($week1ofyear =~ /^jan([1-7])$/) { }
647 343 57 if ($week1ofyear =~ /^dow([1-7])$/) { }
662 400 581 if ($firstdow)
664 171 229 if $forward < 0
672 357 624 if $backward < 0
674 419 562 if ($d < 1)
689 231 121 if exists $self->{'cache'}{'wiy'}{$firstday}{$week1ofyear}{$y}
697 65 56 if ($y1 < $y) { }
702 63 58 if ($y2 < $y + 1) { }
723 325 275 if ($#args == 1)
728 177 148 if exists $self->{'cache'}{'woy'}{$firstday}{$week1ofyear}{$year}{$w}
731 138 10 if $w > 1
744 19 150 if ($y0 == $y and $m == 1 and $d < $d0)
752 106 150 if ($y0 < $y) { }
761 8 248 if ($w > $self->weeks_in_year($y))
780 4 14 if ($cmp == 0) { }
7 7 elsif ($cmp == 1) { }
793 4 10 $y0 == $y1 && $m0 == $m1 && $d0 == $d1 ? :
798 4 10 if ($sameday) { }
815 7 7 if ($minus)
826 2114 2607 defined $h ? :
828 75 4646 if $subtract
833 2607 2114 if ($ymdonly) { }
856 4 12707 if ($ds > 59 or $ds < -59)
860 4 12707 if ($dmn > 59 or $dmn < -59)
865 34 12677 if ($dh > 23 or $dh < -23)
871 5591 7120 if ($subtract)
878 12677 34 if ($dd == 0) { }
890 9 12702 if ($d < 1) { }
892 4 5 if $m < 1
897 68 12634 if ($d > $day_in_mon)
900 59 9 if $m > 12
910 0 0 unless @date
922 2 2423 defined $h ? :
926 1207 1218 if ($subtract) { }
937 1 2424 if $d > $dim
940 2242 183 if ($dd == 0) { }
946 2423 2 if ($ymdonly) { }
969 51 35 if ($subtract)
1006 0 1021 if ($^O =~ /MSWin32/io or $^O =~ /Windows_95/io or $^O =~ /Windows_NT/io) { }
0 1021 elsif ($^O =~ /MacOS/io or $^O =~ /MPE/io or $^O =~ /OS2/io or $^O =~ /NetWare/io) { }
0 1021 elsif ($^O =~ /VMS/io) { }
1049 0 0 unless (defined $var or exists $self->{'data'}{'sections'}{$sect})
1051 0 0 if ($sect eq 'conf') { }
1059 0 253 if ($var eq "_vars")
1073 1 8192 if ($var eq 'defaults') { }
18 8174 elsif ($var eq 'eraseholidays') { }
14 8160 elsif ($var eq 'eraseevents') { }
0 8160 elsif ($var eq 'configfile') { }
0 8160 elsif ($var eq 'encoding') { }
539 7621 elsif ($var eq 'language') { }
533 7088 elsif ($var eq 'yytoyyyy') { }
520 6568 elsif ($var eq 'workweekbeg') { }
520 6048 elsif ($var eq 'workweekend') { }
1026 5022 elsif ($var eq 'workday24hr') { }
526 4496 elsif ($var eq 'workdaybeg') { }
524 3972 elsif ($var eq 'workdayend') { }
699 3273 elsif ($var eq 'firstday') { }
642 2631 elsif ($var eq 'week1ofyear') { }
0 2631 elsif ($var eq 'tz' or $var eq 'forcedate' or $var eq 'setdate') { }
520 2111 elsif ($var eq 'recurrange') { }
522 1589 elsif ($var eq 'defaulttime') { }
1 1588 elsif ($var eq 'periodtimesep') { }
4 1584 elsif ($var eq 'format_mmmyyyy') { }
1584 0 elsif ($var eq 'dateformat' or $var eq 'printable' or $var eq 'tomorrowfirst' or $var eq 'use_posix_printf' or $var eq 'maxrecurattempts') { }
0 0 elsif ($var eq 'jan1week1') { }
1092 0 0 if $err
1096 0 539 if $err
1098 0 539 if $err
1102 0 522 if ($val ne "c" and not $val =~ /^c\d\d$/o and not $val =~ /^c\d\d\d\d$/o and not $val =~ /^\d+$/o)
1112 0 520 if $err
1116 0 520 if $err
1120 0 1026 if $err
1124 0 526 if $err
1128 0 524 if $err
1132 0 699 if $err
1136 0 642 if $err
1147 0 520 if $err
1151 0 522 if $err
1159 0 4 if $err
1172 0 0 if ($val) { }
1194 539 0 if (not $val) { }
0 0 elsif ($val =~ /^(.*),(.*)$/o) { }
1200 0 0 if ($in)
1202 0 0 unless ($o)
1207 0 0 if ($out)
1209 0 0 unless ($o)
1215 0 0 if ($in and $out) { }
0 0 elsif ($in) { }
0 0 elsif ($out) { }
1234 0 0 unless ($o)
1242 522 17 unless (@{$self->{'data'}{'calc'}{'enc_in'};})
1253 520 0 if ($val =~ /^(none|year|month|week|day|all)$/o)
1264 0 520 unless ($self->_is_int($val, 1, 7))
1268 0 520 if ($val >= $self->_config("workweekend"))
1281 0 520 unless ($self->_is_int($val, 1, 7))
1285 0 520 if ($val <= $self->_config("workweekbeg"))
1298 506 520 if ($val)
1317 0 1050 unless (defined $tmp)
1331 0 1050 if ($beg > $end)
1349 0 699 unless ($self->_is_int($val, 1, 7))
1361 56 0 if ($val =~ /^jan[1-7]$/ or $val =~ /^dow[1-7]$/ or $val eq "firstday")
1373 522 0 if (lc $val eq "midnight" or lc $val eq "curr")
1384 2 0 if (lc $val eq "first" or lc $val eq "last" or lc $val eq "")
1404 0 539 unless (exists $Date::Manip::Lang::index::Lang{$lang})
1410 0 539 if exists $self->{'data'}{'sections'}{'conf'} and $self->{'data'}{'sections'}{'conf'} eq $lang
1415 0 539 if ($@)
1480 19 1598 if (exists $self->{'data'}{'lang'}{$ele}) { }
1481 16 3 if (ref $self->{'data'}{'lang'}{$ele}) { }
1514 2695 0 if (exists $self->{'data'}{'lang'}{$ele}) { }
1521 4316 3 if $tmp
1548 0 1617 unless (exists $self->{'data'}{'lang'}{$ele})
1578 5929 1078 unless $subset
1580 7007 0 if (exists $self->{'data'}{'lang'}{$ele}) { }
1582 5929 1078 if not $max or $max > $#vallist + 1
1591 1 213126 unless $str
1643 0 41078 if $N == 0
1645 2809 38269 if ($N < 0) { }
1648 65 2744 if ($$val > $N) { }
96 2648 elsif ($$val < 1) { }
1658 212 38057 if ($$val > $N - 1) { }
159 37898 elsif ($$val < 0) { }
1676 1 54242 if not defined $N && $N =~ /^\s*[-+]?\d+\s*$/o or defined $low and $N < $low or defined $high and $N > $high
1689 0 40810 if not defined $N && ($N =~ /^\s*[-+]?\d+(\.\d*)?\s*$/o || $N =~ /^\s*[-+]?\.\d+\s*$/o) or defined $low and $N < $low or defined $high and $N > $high
1704 1 5756 if (ref $arg eq 'HASH') { }
1 5755 elsif ($arg) { }
1712 81 5676 if ($op eq 'delta') { }
6 5670 elsif ($op eq 'business') { }
1719 4245 1512 if ($op eq 'date') { }
1118 394 elsif ($op eq 'hms') { }
294 100 elsif ($op eq 'offset') { }
13 87 elsif ($op eq 'time') { }
87 0 elsif ($op eq 'delta') { }
1721 1925 2320 if ($string =~ /^(\d\d\d\d)(\d\d)(\d\d)(\d\d):(\d\d):(\d\d)$/o or $string =~ /^(\d\d\d\d)\-(\d\d)\-(\d\d)\-(\d\d):(\d\d):(\d\d)$/o or $string =~ /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/o) { }
1731 1115 3 if ($string =~ /^(\d\d)(\d\d)(\d\d)$/o or $string =~ /^(\d\d)(\d\d)()$/o or $string =~ /^(\d\d?):(\d\d):(\d\d)$/o or $string =~ /^(\d\d?):(\d\d)()$/o or $string =~ /^(\d\d?)()()$/o) { }
1737 1 1114 if $err
1744 288 6 if ($string =~ /^([-+]?\d\d)(\d\d)(\d\d)$/o or $string =~ /^([-+]?\d\d)(\d\d)()$/o or $string =~ /^([-+]?\d\d?):(\d\d?):(\d\d?)$/o or $string =~ /^([-+]?\d\d?):(\d\d?)()$/o or $string =~ /^([-+]?\d\d?)()()$/o) { }
1752 1 287 if $err
1759 12 1 if ($string =~ /^[-+]?\d+(:[-+]?\d+){0,2}$/o) { }
1762 2 10 exists $opts{'nonorm'} ? :
1766 0 12 if $err
1774 0 87 if $err
1779 0 87 exists $opts{'nonorm'} ? :
1784 0 87 if $err
1793 1 27693 if (ref $arg eq 'HASH') { }
2 27691 elsif ($arg) { }
1801 10 27684 if ($op eq 'delta') { }
9 27675 elsif ($op eq 'business') { }
1810 24821 2873 if ($op eq 'date') { }
108 2765 elsif ($op eq 'offset') { }
2733 32 elsif ($op eq 'hms') { }
13 19 elsif ($op eq 'time') { }
19 0 elsif ($op eq 'delta') { }
1813 0 24821 if $err
1815 1 24820 if ($form == 1) { }
1 24819 elsif ($form == 2) { }
1827 3 105 if $err
1832 3 2730 if $err
1838 2 11 exists $opts{'nonorm'} ? :
1842 1 12 if $err
1849 1 18 exists $opts{'nonorm'} ? :
1853 0 19 if $err
1865 436 598 if ($string =~ /^$f(:$f){0,6}$/o) { }
1891 5 38762 unless ($self->_is_int($f))
1898 5542 5 unless ($est)
1899 3407 2135 if $delta[0] or $delta[1]
1903 2135 3407 unless ($est or $approx)
1904 287 1848 if ($mode eq 'business') { }
1905 26 261 if $delta[2]
1907 365 1483 if $delta[2] or $delta[3]
1911 5 5542 if ($est) { }
3407 2135 elsif ($approx) { }
391 1744 elsif ($semi) { }
1914 5 0 if ($type ne "estimated")
1915 1 4 if ($type_from eq "opt")
1926 3397 10 if ($type ne "approx" and $type ne "estimated")
1927 5 3392 if ($type_from eq "opt")
1938 373 14 if ($type ne "semi" and $type ne "approx" and $type ne "estimated")
1939 5 368 if ($type_from eq "opt")
1948 266 1478 unless ($type)
1998 0 40805 unless defined $f
1999 1 40804 unless $self->_is_num($f)
2001 1 5902 if @fields > 7
2022 5333 569 if (defined $source and $source eq 'delta') { }
2023 0 5333 unless (exists $opts->{'type'})
2033 0 569 if $err
2041 5540 362 if ($norm)
2042 354 5186 if ($mode eq 'business') { }
2044 10 344 if ($type eq 'estimated') { }
113 231 elsif ($type eq 'approx' or $type eq 'semi') { }
2057 11 5175 if ($type eq 'estimated') { }
3709 1466 elsif ($type eq 'approx' or $type eq 'semi') { }
2089 562 5364 if ($source eq 'string') { }
2096 356 3530 if ($f =~ /^([-+])/o) { }
2121 0 5926 unless defined $sign
2123 0 5926 if ($sign == 1) { }
370 5556 elsif ($sign == 0) { }
2126 0 0 if $f > 0
2131 31 339 $fields[0] < 0 ? :
2133 26 2146 if ($f > 0 and $s eq '-') { }
323 1823 elsif ($f < 0) { }
2137 197 126 if ($s eq '-') { }
2170 0 67 unless defined $f
2171 0 67 unless $self->_is_int($f)
2173 1 24 if @fields > 3
2192 20 4 if ($norm)
2231 5435 6190 unless $f
2232 1 11624 unless $self->_is_int($f, 0)
2234 1 3880 if @fields > 3
2244 0 0 if $h > 24 or $m > 59 or $s > 59 or $h == 24 and $m > 0 || $s > 0
2251 1148 2730 if ($opts->{'out'} eq 'list') { }
2258 6712 1478 if length $f < 2
2289 147 1037 if not defined $f or $f eq ""
2290 0 1184 unless $self->_is_int($f)
2292 1 395 if @fields > 3
2302 288 107 if ($opts->{'source'} eq 'string') { }
2304 0 287 if $h < -23 or $h > 23 or $m < 0 or $m > 59 or $s < 0 or $s > 59
2310 33 74 if ($h > 0) { }
54 20 elsif ($h < 0) { }
2 18 elsif ($m > 0) { }
0 18 elsif ($m < 0) { }
2311 0 31 if $h > 23 or $m < 0 or $m > 59 or $s < 0 or $s > 59
2315 0 54 if $h < -23 or $m < -59 or $m > 0 or $s < -59 or $s > 0
2319 0 2 if $m > 59 or $s < 0 or $s > 59
2322 0 0 if $m < -59 or $s < -59 or $s > 0
2325 0 18 if $s < -59 or $s > 59
2334 287 105 if ($opts->{'source'} eq 'string') { }
2339 196 91 if ($h =~ /^\-/) { }
0 91 elsif ($m =~ /^\-/) { }
2363 105 287 if ($opts->{'out'} eq "string")
2365 54 51 if ($h < 0 or $m < 0 or $s < 0) { }
2374 98 7 if length $h < 2
2375 87 18 if length $m < 2
2376 103 2 if length $s < 2
2389 0 55059 if @fields != 6
2394 44495 10564 if length $m == 1
2395 36561 18498 if length $d == 1
2396 41966 13093 if length $h == 1
2397 45641 9418 if length $mn == 1
2398 48161 6898 if length $s == 1
2400 24821 30238 if (wantarray) { }
2413 1 93 unless defined $fields
2424 21 3824 if (defined $s) { }
2607 1 42 if ($flag eq 'dom') { }
4 38 elsif ($flag eq 'last') { }
38 0 elsif ($flag eq 'ge') { }
0 0 elsif ($flag eq 'le') { }
2645 39 4 if ($timetype eq 'w') { }
2 2 elsif ($timetype eq 'u') { }
2646 25 14 $isdst ? :
2654 27 16 $isdst ? :
2655 27 16 $isdst ? :
2668 4619 4972 if (lc $enc eq 'utf-8') { }
4619 353 elsif (lc $enc eq 'perl') { }
2670 4598 21 if &is_utf8($string, 1)
2678 353 0 if &is_utf8($tmp, 1)