Branch Coverage

lib/Date/Manip/Base.pm
Criterion Covered Total %
branch 469 578 81.1


line true false branch
54 0 499 if exists $self->{'cache'}{'init'}
71 1 499 if exists $self->{'data'}{'calc'} and not $force
81 0 500 if exists $self->{'data'}{'sections'}{'conf'} and not $force
228 1014 514 unless $beg
229 1014 514 unless $end
269 0 513 if exists $self->{'data'}{'events'} and not $force
304 0 517 if exists $self->{'data'}{'holidays'} and not $force
359 0 1032 if exists $self->{'data'}{'lang'} and not $force
379 7664 4729 if (ref $arg) { }
390 6 4723 if ($ddd < 0)
412 1313 8619 if $dow == 0
418 1364 2416 if $y % 4 == 0 and $y % 100 != 0 or $y % 400 == 0
425 109 258 $self->leapyear($y) ? :
433 2 37178 if (not $m) { }
2904 34274 elsif ($m == 2) { }
434 1 1 if $self->leapyear($y)
457 265 409 if (@args == 2) { }
463 9 256 if $tmp =~ /\./
469 265 800 if $n <= $doy_days[$ly][$m]
472 256 9 unless $time
479 4 5 if "$s" ne int $s
488 238 171 $m > 2 ? :
491 379 30 unless defined $h
505 913 84 $m ? :
513 913 84 if ($m) { }
515 8 905 $n < 0 ? :
519 0 84 $n < 0 ? :
520 0 84 if ($n < 0) { }
532 550 447 if ($dow < $ddow) { }
537 8 989 if $d > $max
541 847 150 if ($n > 1) { }
2 148 elsif ($n < -1) { }
543 0 847 if $d > $max
546 0 2 if $d < 1
551 913 84 if ($m)
568 2555 5 if (ref $arg) { }
595 7 15328 if not $self->check_time([$h, $mn, $s]) or $y < 1 or $y > 9999 or $m < 1 or $m > 12
601 4 15324 if $d < 1 or $d > $days
609 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
625 326 274 if exists $self->{'cache'}{'week1day1'}{$firstday}{$jan1week1}{$year}
630 84 190 if $jan1week1
635 243 31 if ($dow != $firstday)
636 103 140 if $firstday == 7
638 153 90 if ($d < 1)
659 177 108 if exists $self->{'cache'}{'wiy'}{$firstday}{$jan1week1}{$y}
667 58 50 if ($y1 < $y) { }
672 60 48 if ($y2 < $y + 1) { }
693 325 208 if ($#args == 1)
698 177 148 if exists $self->{'cache'}{'woy1'}{$firstday}{$jan1week1}{$year}{$w}
701 138 10 if $w > 1
714 3 133 if ($y0 == $y and $m == 1 and $d < $d0)
722 72 133 if ($y0 < $y) { }
731 5 200 if ($w > $self->_weeks_in_year($firstday, $y))
750 4 14 if ($cmp == 0) { }
7 7 elsif ($cmp == 1) { }
763 4 10 $y0 == $y1 && $m0 == $m1 && $d0 == $d1 ? :
768 4 10 if ($sameday) { }
785 7 7 if ($minus)
796 2114 2607 defined $h ? :
798 75 4646 if $subtract
803 2607 2114 if ($ymdonly) { }
826 4 12709 if ($ds > 59 or $ds < -59)
830 4 12709 if ($dmn > 59 or $dmn < -59)
835 34 12679 if ($dh > 23 or $dh < -23)
841 5592 7121 if ($subtract)
848 12679 34 if ($dd == 0) { }
860 9 12704 if ($d < 1) { }
862 4 5 if $m < 1
867 68 12636 if ($d > $day_in_mon)
870 59 9 if $m > 12
880 0 0 unless @date
892 2 2423 defined $h ? :
896 1207 1218 if ($subtract) { }
907 1 2424 if $d > $dim
910 2242 183 if ($dd == 0) { }
916 2423 2 if ($ymdonly) { }
939 51 35 if ($subtract)
976 0 1009 if ($^O =~ /MSWin32/io or $^O =~ /Windows_95/io or $^O =~ /Windows_NT/io) { }
0 1009 elsif ($^O =~ /MacOS/io or $^O =~ /MPE/io or $^O =~ /OS2/io or $^O =~ /NetWare/io) { }
0 1009 elsif ($^O =~ /VMS/io) { }
1019 0 0 unless (defined $var or exists $self->{'data'}{'sections'}{$sect})
1021 0 0 if ($sect eq 'conf') { }
1029 0 253 if ($var eq "_vars")
1043 1 7839 if ($var eq 'defaults') { }
18 7821 elsif ($var eq 'eraseholidays') { }
14 7807 elsif ($var eq 'eraseevents') { }
0 7807 elsif ($var eq 'configfile') { }
0 7807 elsif ($var eq 'encoding') { }
533 7274 elsif ($var eq 'language') { }
527 6747 elsif ($var eq 'yytoyyyy') { }
514 6233 elsif ($var eq 'workweekbeg') { }
514 5719 elsif ($var eq 'workweekend') { }
1014 4705 elsif ($var eq 'workday24hr') { }
520 4185 elsif ($var eq 'workdaybeg') { }
518 3667 elsif ($var eq 'workdayend') { }
536 3131 elsif ($var eq 'firstday') { }
0 3131 elsif ($var eq 'tz' or $var eq 'forcedate' or $var eq 'setdate') { }
514 2617 elsif ($var eq 'recurrange') { }
516 2101 elsif ($var eq 'defaulttime') { }
1 2100 elsif ($var eq 'periodtimesep') { }
4 2096 elsif ($var eq 'format_mmmyyyy') { }
2096 0 elsif ($var eq 'dateformat' or $var eq 'jan1week1' or $var eq 'printable' or $var eq 'maxrecurattempts' or $var eq 'tomorrowfirst') { }
1062 0 0 if $err
1066 0 533 if $err
1068 0 533 if $err
1072 0 516 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)
1082 0 514 if $err
1086 0 514 if $err
1090 0 1014 if $err
1094 0 520 if $err
1098 0 518 if $err
1102 0 536 if $err
1113 0 514 if $err
1117 0 516 if $err
1125 0 4 if $err
1149 533 0 if (not $val) { }
0 0 elsif ($val =~ /^(.*),(.*)$/o) { }
1155 0 0 if ($in)
1157 0 0 unless ($o)
1162 0 0 if ($out)
1164 0 0 unless ($o)
1170 0 0 if ($in and $out) { }
0 0 elsif ($in) { }
0 0 elsif ($out) { }
1189 0 0 unless ($o)
1197 516 17 unless (@{$self->{'data'}{'calc'}{'enc_in'};})
1208 514 0 if ($val =~ /^(none|year|month|week|day|all)$/o)
1219 0 514 unless ($self->_is_int($val, 1, 7))
1223 0 514 if ($val >= $self->_config("workweekend"))
1236 0 514 unless ($self->_is_int($val, 1, 7))
1240 0 514 if ($val <= $self->_config("workweekbeg"))
1253 500 514 if ($val)
1272 0 1038 unless (defined $tmp)
1286 0 1038 if ($beg > $end)
1304 0 536 unless ($self->_is_int($val, 1, 7))
1315 516 0 if (lc $val eq "midnight" or lc $val eq "curr")
1326 2 0 if (lc $val eq "first" or lc $val eq "last" or lc $val eq "")
1346 0 533 unless (exists $Date::Manip::Lang::index::Lang{$lang})
1352 0 533 if exists $self->{'data'}{'sections'}{'conf'} and $self->{'data'}{'sections'}{'conf'} eq $lang
1357 0 533 if ($@)
1422 19 1580 if (exists $self->{'data'}{'lang'}{$ele}) { }
1423 16 3 if (ref $self->{'data'}{'lang'}{$ele}) { }
1456 2665 0 if (exists $self->{'data'}{'lang'}{$ele}) { }
1463 4268 3 if $tmp
1490 0 1599 unless (exists $self->{'data'}{'lang'}{$ele})
1520 5863 1066 unless $subset
1522 6929 0 if (exists $self->{'data'}{'lang'}{$ele}) { }
1524 5863 1066 if not $max or $max > $#vallist + 1
1533 1 210259 unless $str
1585 0 41084 if $N == 0
1587 2809 38275 if ($N < 0) { }
1590 65 2744 if ($$val > $N) { }
96 2648 elsif ($$val < 1) { }
1600 212 38063 if ($$val > $N - 1) { }
159 37904 elsif ($$val < 0) { }
1618 1 53995 if not defined $N && $N =~ /^\s*[-+]?\d+\s*$/o or defined $low and $N < $low or defined $high and $N > $high
1631 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
1646 1 5731 if (ref $arg eq 'HASH') { }
1 5730 elsif ($arg) { }
1654 81 5651 if ($op eq 'delta') { }
6 5645 elsif ($op eq 'business') { }
1661 4232 1500 if ($op eq 'date') { }
1106 394 elsif ($op eq 'hms') { }
294 100 elsif ($op eq 'offset') { }
13 87 elsif ($op eq 'time') { }
87 0 elsif ($op eq 'delta') { }
1663 1925 2307 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) { }
1673 1103 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) { }
1679 1 1102 if $err
1686 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) { }
1694 1 287 if $err
1701 12 1 if ($string =~ /^[-+]?\d+(:[-+]?\d+){0,2}$/o) { }
1704 2 10 exists $opts{'nonorm'} ? :
1708 0 12 if $err
1716 0 87 if $err
1721 0 87 exists $opts{'nonorm'} ? :
1726 0 87 if $err
1735 1 27683 if (ref $arg eq 'HASH') { }
2 27681 elsif ($arg) { }
1743 10 27674 if ($op eq 'delta') { }
9 27665 elsif ($op eq 'business') { }
1752 24823 2861 if ($op eq 'date') { }
108 2753 elsif ($op eq 'offset') { }
2721 32 elsif ($op eq 'hms') { }
13 19 elsif ($op eq 'time') { }
19 0 elsif ($op eq 'delta') { }
1755 0 24823 if $err
1757 1 24822 if ($form == 1) { }
1 24821 elsif ($form == 2) { }
1769 3 105 if $err
1774 3 2718 if $err
1780 2 11 exists $opts{'nonorm'} ? :
1784 1 12 if $err
1791 1 18 exists $opts{'nonorm'} ? :
1795 0 19 if $err
1807 436 598 if ($string =~ /^$f(:$f){0,6}$/o) { }
1833 5 38762 unless ($self->_is_int($f))
1840 5542 5 unless ($est)
1841 3407 2135 if $delta[0] or $delta[1]
1845 2135 3407 unless ($est or $approx)
1846 287 1848 if ($mode eq 'business') { }
1847 26 261 if $delta[2]
1849 365 1483 if $delta[2] or $delta[3]
1853 5 5542 if ($est) { }
3407 2135 elsif ($approx) { }
391 1744 elsif ($semi) { }
1856 5 0 if ($type ne "estimated")
1857 1 4 if ($type_from eq "opt")
1868 3397 10 if ($type ne "approx" and $type ne "estimated")
1869 5 3392 if ($type_from eq "opt")
1880 373 14 if ($type ne "semi" and $type ne "approx" and $type ne "estimated")
1881 5 368 if ($type_from eq "opt")
1890 266 1478 unless ($type)
1940 0 40805 unless defined $f
1941 1 40804 unless $self->_is_num($f)
1943 1 5902 if @fields > 7
1964 5333 569 if (defined $source and $source eq 'delta') { }
1965 0 5333 unless (exists $opts->{'type'})
1975 0 569 if $err
1983 5540 362 if ($norm)
1984 354 5186 if ($mode eq 'business') { }
1986 10 344 if ($type eq 'estimated') { }
113 231 elsif ($type eq 'approx' or $type eq 'semi') { }
1999 11 5175 if ($type eq 'estimated') { }
3709 1466 elsif ($type eq 'approx' or $type eq 'semi') { }
2031 562 5364 if ($source eq 'string') { }
2038 356 3530 if ($f =~ /^([-+])/o) { }
2063 0 5926 unless defined $sign
2065 0 5926 if ($sign == 1) { }
370 5556 elsif ($sign == 0) { }
2068 0 0 if $f > 0
2073 31 339 $fields[0] < 0 ? :
2075 26 2146 if ($f > 0 and $s eq '-') { }
323 1823 elsif ($f < 0) { }
2079 197 126 if ($s eq '-') { }
2112 0 67 unless defined $f
2113 0 67 unless $self->_is_int($f)
2115 1 24 if @fields > 3
2134 20 4 if ($norm)
2173 5411 6142 unless $f
2174 1 11552 unless $self->_is_int($f, 0)
2176 1 3856 if @fields > 3
2186 0 0 if $h > 24 or $m > 59 or $s > 59 or $h == 24 and $m > 0 || $s > 0
2193 1136 2718 if ($opts->{'out'} eq 'list') { }
2200 6682 1472 if length $f < 2
2231 147 1037 if not defined $f or $f eq ""
2232 0 1184 unless $self->_is_int($f)
2234 1 395 if @fields > 3
2244 288 107 if ($opts->{'source'} eq 'string') { }
2246 0 287 if $h < -23 or $h > 23 or $m < 0 or $m > 59 or $s < 0 or $s > 59
2252 33 74 if ($h > 0) { }
54 20 elsif ($h < 0) { }
2 18 elsif ($m > 0) { }
0 18 elsif ($m < 0) { }
2253 0 31 if $h > 23 or $m < 0 or $m > 59 or $s < 0 or $s > 59
2257 0 54 if $h < -23 or $m < -59 or $m > 0 or $s < -59 or $s > 0
2261 0 2 if $m > 59 or $s < 0 or $s > 59
2264 0 0 if $m < -59 or $s < -59 or $s > 0
2267 0 18 if $s < -59 or $s > 59
2276 287 105 if ($opts->{'source'} eq 'string') { }
2281 196 91 if ($h =~ /^\-/) { }
0 91 elsif ($m =~ /^\-/) { }
2305 105 287 if ($opts->{'out'} eq "string")
2307 54 51 if ($h < 0 or $m < 0 or $s < 0) { }
2316 98 7 if length $h < 2
2317 87 18 if length $m < 2
2318 103 2 if length $s < 2
2331 0 55031 if @fields != 6
2336 44008 11023 if length $m == 1
2337 36992 18039 if length $d == 1
2338 41940 13091 if length $h == 1
2339 45424 9607 if length $mn == 1
2340 48159 6872 if length $s == 1
2342 24823 30208 if (wantarray) { }
2355 1 93 unless defined $fields
2366 21 3824 if (defined $s) { }
2549 1 42 if ($flag eq 'dom') { }
4 38 elsif ($flag eq 'last') { }
38 0 elsif ($flag eq 'ge') { }
0 0 elsif ($flag eq 'le') { }
2587 39 4 if ($timetype eq 'w') { }
2 2 elsif ($timetype eq 'u') { }
2588 25 14 $isdst ? :
2596 27 16 $isdst ? :
2597 27 16 $isdst ? :
2610 4606 4959 if (lc $enc eq 'utf-8') { }
4606 353 elsif (lc $enc eq 'perl') { }
2612 4585 21 if &is_utf8($string, 1)
2620 353 0 if &is_utf8($tmp, 1)