Branch Coverage

blib/lib/DateTime/Format/Strptime.pm
Criterion Covered Total %
branch 154 174 88.5


line true false branch
30 1 2 if ($_[$i] eq '-api_version') { }
86 0 293 if ($self->{'debug'})
87 0 0 unless binmode STDERR, ':encoding(UTF-8)'
220 0 289 if ($self->{'debug'})
226 6 283 unless (@matches)
228 0 6 if ($self->{'debug'})
239 0 1109 unless (defined $matches[$i])
252 5 267 unless $constructor and $args
255 9 258 unless $dt
257 2 259 if ($post_construct)
260 25 192 unless $dt and $self->_check_dt($dt, \%args)
263 1 191 if $self->{'time_zone'}
291 0 294 if ($self->{'debug'} and $pattern ne $self->{'pattern'})
314 1139 839 if ($1) { }
6 833 elsif ($3) { }
1 832 elsif ($4) { }
315 0 1139 unless my $p = $patterns->{$1}
318 1128 11 if ($p->{'field'}) { }
327 2 4 $2 ? :
340 8 285 $self->{'strict'} ? :
465 0 6224 unless length $b <=> length $a
475 0 11771 unless length $b <=> length $a
486 0 0 unless length $b <=> length $a
505 44 294 if $self->{'locale_days'}
522 75 294 if $self->{'locale_months'}
539 0 0 unless length $b <=> length $a
570 75 208 if (defined $args->{'month_name'})
572 0 75 unless my $num = $self->_locale_months->{lc $args->{'month_name'}}
578 12 271 if (defined $args->{'am_pm'} and defined $args->{'hour_12'}) { }
3 268 elsif (defined $args->{'hour_12'}) { }
582 4 8 if (lc $args->{'am_pm'} eq lc $am) { }
583 0 4 if $args->{'hour'} == 12
586 8 0 unless $args->{'hour'} == 12
597 10 270 if (defined $args->{'year_100'})
598 1 9 if (defined $args->{'century'}) { }
604 4 5 $args->{'year_100'} >= 69 ? :
611 14 266 if ($args->{'time_zone_offset'})
614 1 13 if ($offset eq 'Z') { }
2 11 elsif ($offset =~ /^[+-][0-9]{2}$/) { }
622 3 11 unless ($tz)
632 18 259 if (defined $args->{'time_zone_abbreviation'}) { }
634 3 15 unless (exists $self->{'zone_map'}{$abbr})
640 4 11 unless (defined $self->{'zone_map'}{$abbr})
653 8 262 if ($args->{'time_zone_name'})
656 6 2 unless ($tz = &try(sub {
662 3 5 unless ($tz)
668 5 0 if $tz
680 6 261 if (defined $args->{'nanosecond'})
687 3 3 if length $args->{'nanosecond'} != 9
694 179 622 unless defined $args->{$k}
697 28 239 if (defined $args->{'epoch'}) { }
4 235 elsif ($args->{'day_of_year'}) { }
704 2 26 if (my $nano = $args->{'nanosecond'})
731 4 254 if (defined $args->{'hour'} and defined $args->{'hour_12'})
732 3 1 unless ($args->{'hour'} % 12 == $args->{'hour_12'})
740 27 228 if (defined $args->{'hour'} and defined $args->{'am_pm'})
741 6 21 if ($is_am and $args->{'hour'} >= 12 or not $is_am and $args->{'hour'} < 12)
750 4 245 if (defined $args->{'year'} and defined $args->{'century'})
751 3 1 unless (int $args->{'year'} / 100 == $args->{'century'})
759 4 242 if (defined $args->{'year'} and defined $args->{'year_100'})
760 3 1 unless ($args->{'year'} % 100 == $args->{'year_100'})
768 4 239 if (defined $args->{'time_zone_abbreviation'} and defined $args->{'time_zone_offset'})
770 3 1 unless ($self->{'zone_map'}{$args->{'time_zone_abbreviation'}} and $self->{'zone_map'}{$args->{'time_zone_abbreviation'}} eq $args->{'time_zone_offset'})
782 28 212 if (defined $args->{'epoch'})
785 24 116 if (defined $args->{$key} and $dt->$key != $args->{$key})
786 3 18 $key eq 'day_of_year' ? :
3 21 $key eq 'hour_12' ? :
798 4 212 if (defined $args->{'month'} and defined $args->{'day_of_year'})
799 3 1 unless ($dt->month == $args->{'month'})
807 44 169 if (defined $args->{'day_name'})
809 0 44 unless defined $dow
813 3 41 unless ($dt->day_of_week_0 == $dow)
823 4 206 if (defined $args->{'day_of_week'})
824 3 1 unless ($dt->day_of_week == $args->{'day_of_week'})
834 4 203 if (defined $args->{'day_of_week_sun_0'})
835 3 1 unless ($dt->day_of_week % 7 == $args->{'day_of_week_sun_0'})
845 4 200 if (defined $args->{'iso_week_year'})
846 3 1 unless ($dt->week_year == $args->{'iso_week_year'})
856 4 197 if (defined $args->{'iso_week_year_100'})
857 3 1 unless (0 + substr($dt->week_year, -2) == $args->{'iso_week_year_100'})
868 4 194 if (defined $args->{'week_mon_1'})
869 3 1 unless (0 + $dt->strftime('%W') == $args->{'week_mon_1'})
879 4 191 if (defined $args->{'week_sun_0'})
880 3 1 unless (0 + $dt->strftime('%U') == $args->{'week_sun_0'})
903 29 0 $self->{'locale'}->can('code') ? :
937 32 65 if ref $self->{'on_error'}
938 33 32 if $self->{'on_error'} eq 'croak'