Branch Coverage

blib/lib/DateTime.pm
Criterion Covered Total %
branch 297 326 91.1


line true false branch
119 50 25395 if (@_)
183 2 48747 if $p{'day'} > 28 and $p{'day'} > $class->_month_length($p{"year"}, $p{'month'})
193 2 57555 if ref $class
198 0 57555 unless exists $p{'month'}
199 0 57555 unless exists $p{'day'}
200 0 57555 unless exists $p{'hour'}
201 0 57555 unless exists $p{'minute'}
202 0 57555 unless exists $p{'second'}
203 46 57509 unless exists $p{'nanosecond'}
204 1328 56227 unless exists $p{'time_zone'}
214 200 57355 ref $p{'time_zone'} ? :
247 49 57503 if ($p{'second'} > 59)
248 3 46 if ($self->{'tz'}->is_floating or $self->{'utc_rd_secs'} - 86399 < $p{'second'} - 59)
273 32137 25420 if (defined $locale and ref $locale) { }
278 25 25395 $locale ? :
298 2 198 if defined $self->formatter
301 169 31 delete $p{'_skip_validation'} ? :
311 87177 33671 if $self->{'tz'}->is_floating
318 161 33510 $utc_is_valid ? :
321 33399 272 if ($offset >= 0 and $self->{'local_rd_secs'} >= $offset) { }
28 284 elsif ($offset < 0 and $self->{'local_rd_secs'} >= 86400 + $offset) { }
323 44 33355 if ($second < 60 and $offset > 0) { }
42 33315 elsif ($second == 60 and $self->{'local_rd_secs'} == $offset && $offset > 0 || $offset == 0 && $self->{'local_rd_secs'} > 86399) { }
340 41 1 unless ($mod == 0)
349 21 7 if ($second < 60) { }
5 2 elsif ($second == 60 and $self->{'local_rd_secs'} == 86400 + $offset) { }
360 5 0 unless ($mod == 0)
374 113040 178 if ($self->{'tz'}->is_utc or $self->{'tz'}->is_floating) { }
398 7545 78 if $self->{'utc_rd_secs'} >= 0 and $self->{'utc_rd_secs'} <= 86399
400 3 75 if ($self->{'tz'}->is_floating) { }
421 57548 258 if ($self->{'tz'}->is_utc or $self->{'tz'}->is_floating) { }
489 3 56 if (@_ == 1 and not is_HashRef($_[0])) { }
514 8 48 if (int $p{'epoch'} != $p{'epoch'})
519 2 6 if ($nano < 0)
537 4 50 if exists $p{'time_zone'}
553 57599 10 unless $year >= 5000 and $tz
555 0 10 ref $tz ? :
556 5 5 if $tz_name eq "floating" or $tz_name eq "UTC"
594 2 31945 if ($object->isa("DateTime::Infinite"))
608 6 687 if ($object->can("time_zone") and not $object->time_zone->is_floating and $rd_secs > 86399 and $rd_secs <= $class->_day_length($rd_days))
626 31943 2 if ($object->can('time_zone')) { }
691 10424 29674 $_[0]->_is_leap_year($_[1]) ? :
740 1 1123 if $p{'day_of_year'} == 366 and not $class->_is_leap_year($p{"year"})
745 1028 95 if ($day > 31)
768 0 1745 if @_ > 1
775 12 11 $_[0]{'local_c'}{'year'} <= 0 ? :
785 2 11 $_[0]{'local_c'}{'year'} <= 0 ? :
787 2 2 $_[0]->ce_year > 0 ? :
788 2 2 $_[0]->ce_year > 0 ? :
795 0 8616 if @_ > 1
810 0 15907 if @_ > 1
867 8 17 $_[0]->hour < 12 ? :
872 662 166 unless defined $sep
885 2 2 unless defined $sep
897 2 2 unless defined $sep
908 0 551 if @_ > 1
911 1 6 $_[0]{'local_c'}{'hour'} == 0 ? :
913 26 7 $h ? :
917 0 501 if @_ > 1
923 0 63801 if @_ > 1
931 0 468 if @_ > 1
942 1 2 if $self->{'tz'}->is_floating
950 31 5 unless $self->{'formatter'}
956 2 166 unless defined $sep
975 1 3 if $self->{'tz'}->is_floating
978 2 1 $secs ? :
988 118 45 unless defined $sep
1000 4 11 $_[0]->_is_leap_year($_[0]->year) ? :
1007 1 4 $_[0]->_is_leap_year($_[0]->year) ? :
1039 4 27 if ($week == 0) { }
5 42 elsif ($week == 53 and $self->_weeks_in_year($year) == 52) { }
1058 4 7 $dow == 4 || $dow == 3 && $self->_is_leap_year($year) ? :
1076 0 82348 if @_ > 1
1092 0 213 if @_ > 1
1213 6 1 $self->can($1) ? :
237 1 $strftime_patterns{$2} ? :
25 0 $3 ? :
238 25 $2 ? :
7 263 $1 ? :
1218 185 2 unless wantarray
1394 23 0 defined $4 ? :
144 23 defined $2 ? :
4 167 defined $1 ? :
1405 129 0 unless wantarray
1419 144 3362 if ($pattern =~ /$patterns[$i]/)
1432 29 2 @_ ? :
1439 4 27 $exponent < 0 ? :
1453 2 27 if exists $self->{'utc_c'}{'epoch'}
1465 0 2 unless defined $epoch
1483 4 51 unless $dt1->time_zone eq $dt2->time_zone
1487 39 16 $dt1 >= $dt2 ? :
1497 43 12 unless ($is_floating)
1500 5 38 if ($utc_rd_secs >= 86340 and not $is_floating)
1527 11 44 if ($bigger->time_zone->has_dst_changes and $bigger->is_dst != $smaller->is_dst)
1535 4 1 if $bigger->is_dst and do {
1537 4 1 $prev_day && !$prev_day->is_dst ? :
1546 1 5 if not $bigger->is_dst and do {
1548 1 5 $prev_day && $prev_day->is_dst ? :
1574 16 39 if ($negative)
1578 30 50 if $_
1604 7 52 if ($nano1 < $nano2)
1609 8 51 if ($sec1 < $sec2)
1616 11 48 if ($min1 < $min2)
1621 12 47 if ($day1 < $day2)
1641 6 2 unless $self->time_zone->is_floating
1645 6 2 unless $dt->time_zone->is_floating
1650 1 7 if ($nanoseconds < 0)
1722 0 9133 if ($reversed)
1726 2 9131 unless (DateTime::Helpers::isa($dur, "DateTime::Duration"))
1741 0 22828 if ($reversed)
1745 22806 22 if (DateTime::Helpers::isa($date2, 'DateTime::Duration')) { }
20 2 elsif (DateTime::Helpers::isa($date2, 'DateTime')) { }
1774 53 1 if (@_ % 2 == 0)
1778 1 52 if exists $p{'end_of_month'}
1792 2 0 if @_ == 1 and &blessed($_[0]) and $_[0]->isa($self->duration_class)
1815 744 31940 if $dur->is_zero
1823 1 159691 if ($val == 9**9**9) { }
1 159690 elsif ($val == -9**9**9) { }
1830 2 159690 if ($inf)
1838 4 31934 if $self->is_infinite
1857 23769 8165 if ($deltas{'days'})
1863 540 31394 if ($deltas{'months'})
1872 113 427 $dur->is_preserve_mode ? :
1874 113 427 if $dur->is_preserve_mode
1876 2 538 if (not $dur->is_wrap_mode and $d > 28) { }
1888 1 1 if $last_day > $d
1898 24306 7628 if ($deltas{'days'} or $deltas{'months'})
1904 74 31858 if ($deltas{'minutes'})
1914 7577 24355 if ($deltas{'seconds'} or $deltas{'nanoseconds'})
1917 3 7574 if ($deltas{'nanoseconds'})
1936 0 31932 $self->{'formatter'} ? :
1949 2 8930 unless defined $_[1]
1951 1 8929 $_[2] ? :
1958 12 10 if (not DateTime::Helpers::can($dt2, 'utc_rd_values')) { }
1959 2 10 $flip ? :
1977 8952 57 ref $_[0] ? :
1979 0 9009 unless defined $dt2
1981 6 1 if (not ref $dt2 and $dt2 == 9**9**9 || $dt2 == -9**9**9)
1985 2 9001 unless (DateTime::Helpers::can($dt1, "utc_rd_values") and DateTime::Helpers::can($dt2, "utc_rd_values"))
1994 8997 2 if (not $consistent and DateTime::Helpers::can($dt1, "time_zone") and DateTime::Helpers::can($dt2, "time_zone"))
2000 2 8995 if ($is_floating1 and not $is_floating2) { }
3 9103 elsif ($is_floating2 and not $is_floating1) { }
2012 8933 239 if $dt1_components[$i] != $dt2_components[$i]
2028 16 0 ref $_[0] ? :
2030 10 6 unless (DateTime::Helpers::can($dt2, "utc_rd_values"))
2046 1 57557 if ($_[2] < 0) { }
1 57556 elsif ($_[2] >= 1000000000) { }
2103 0 31 if ($p{'locale'})
2194 25 145 if ($p{'to'} eq 'week' or $p{'to'} eq 'local_week') { }
108 37 elsif ($p{'to'} eq 'quarter') { }
2198 16 9 $p{'to'} eq 'local_week' ? :
2202 22 3 if ($day_diff)
2231 143 116 $truncate ? :
2233 37 222 if $p{'to'} eq $f
2248 31951 52 if (ref $tz) { }
2253 587 31364 if $self->{'tz'} eq $tz
2256 1 51 if $self->{'tz'}->name eq $tz
2262 31364 51 ref $tz ? :
2269 31259 156 if ($self->{'tz'}->is_floating xor $was_floating) { }
156 0 elsif (not $was_floating) { }
2282 1 31414 if ($e)
2321 4 0 if (@_) { }
2342 1 3 defined $$formatter ? :