Branch Coverage

blib/lib/PDL/DateTime.pm
Criterion Covered Total %
branch 146 286 51.0


line true false branch
37 102 1551 ref $class ? :
45 1 9 if ref $data eq 'PDL::DateTime'
49 1 8 if (ref $data eq 'ARRAY') { }
8 0 elsif (ref $data eq 'PDL') { }
53 8 0 if ($data->type == longlong()) { }
0 0 elsif ($data->type == double()) { }
70 0 0 if (&looks_like_number($data)) { }
0 0 elsif ($data) { }
98 1 2 if ref $ep eq 'ARRAY'
107 1 2 if ref $rd eq 'ARRAY'
117 1 2 if ref $sd eq 'ARRAY'
127 1 2 if ref $jd eq 'ARRAY'
143 0 3 unless defined $y and defined $m and defined $d
145 1 2 if ref $y eq 'ARRAY'
146 1 2 if ref $d eq 'ARRAY'
147 1 2 if ref $m eq 'ARRAY'
148 1 2 if ref $H eq 'ARRAY'
149 1 2 if ref $M eq 'ARRAY'
150 1 2 if ref $S eq 'ARRAY'
151 1 2 if ref $U eq 'ARRAY'
154 2 1 if defined $H
155 2 1 if defined $M
156 2 1 if defined $S
158 2 1 if defined $U
173 0 44 unless defined $count and defined $unit
174 5 39 unless defined $step
176 0 44 $start eq 'now' ? :
178 5 39 if ($unit eq 'year')
184 0 44 if ($unit eq 'quarter')
190 12 32 if ($unit eq 'month') { }
27 5 elsif (my $inc = $INC_SECONDS{$unit}) { }
304 16 32 if ($self->is_inplace) { }
308 3 13 if ($unit eq 'month') { }
0 13 elsif ($unit eq 'quarter') { }
4 9 elsif ($unit eq 'year') { }
1 8 elsif ($unit eq 'millisecond') { }
1 7 elsif ($unit eq 'microsecond') { }
7 0 elsif (my $inc = $INC_SECONDS{$unit}) { }
334 6 26 if ($unit eq 'month') { }
0 26 elsif ($unit eq 'quarter') { }
8 18 elsif ($unit eq 'year') { }
2 16 elsif ($unit eq 'millisecond') { }
2 14 elsif ($unit eq 'microsecond') { }
14 0 elsif (my $inc = $INC_SECONDS{$unit}) { }
359 8 16 if ($self->is_inplace) { }
361 0 8 unless defined $unit
362 1 7 if ($unit eq 'year') { }
0 7 elsif ($unit eq 'quarter') { }
1 6 elsif ($unit eq 'month') { }
1 5 elsif ($unit eq 'millisecond') { }
5 0 elsif (my $inc = $INC_SECONDS{$unit}) { }
376 1 4 $unit eq 'week' ? :
377 0 5 if $up and $unit eq 'week'
383 0 16 unless defined $unit
384 3 13 if ($unit eq 'year') { }
0 13 elsif ($unit eq 'quarter') { }
2 11 elsif ($unit eq 'month') { }
1 10 elsif ($unit eq 'millisecond') { }
10 0 elsif (my $inc = $INC_SECONDS{$unit}) { }
397 2 8 $unit eq 'week' ? :
398 0 10 if $up and $unit eq 'week'
406 5 0 &looks_like_number($_[-1]) ? :
408 5 0 if not $fmt or $fmt eq 'auto'
420 70 43 if not $fmt or $fmt eq 'auto'
421 1 112 if ($fmt eq 'epoch') { }
1 111 elsif ($fmt eq 'epoch_int') { }
436 0 0 if $self->nelem == 1
438 0 0 unless $unit
439 0 0 if $unit eq 'week'
440 0 0 if $unit eq 'day'
441 0 0 if $unit eq 'hour'
442 0 0 if $unit eq 'minute'
443 0 0 if $unit eq 'second'
444 0 0 if $unit eq 'millisecond'
450 0 0 unless $self->is_increasing or $self->is_decreasing
452 0 0 if $freq eq 'BAD' or $freq < 0
453 0 0 if ($freq < 1000) { }
0 0 elsif ($freq < 1000000) { }
0 0 elsif ($freq < 60000000) { }
0 0 elsif ($freq < 3600000000) { }
0 0 elsif ($freq < 86400000000) { }
0 0 elsif ($freq == 86400000000) { }
0 0 elsif ($freq == 604800000000) { }
0 0 elsif ($freq >= 2419200000000 and $freq <= 2678400000000) { }
0 0 elsif ($freq >= 7776000000000 and $freq <= 7948800000000) { }
0 0 elsif ($freq >= 31536000000000 and $freq <= 31622400000000) { }
498 0 0 unless $unit
499 0 0 unless $self->ndims == 1
500 0 0 unless $self->is_increasing
506 0 0 unless $unit
507 0 0 unless $self->ndims == 1
508 0 0 unless $self->is_increasing
511 0 0 if ($end->nelem == 0) { }
515 0 0 unless $end->at($end->nelem - 1) == $end->nelem - 1
522 0 0 unless $unit
523 0 0 unless $self->ndims == 1
524 0 0 unless $self->is_increasing
527 0 0 if $end->nelem > 1
533 0 0 unless $unit
539 0 0 if $strictly
545 0 0 if $strictly
568 1 0 $self->ndims > 0 ? :
576 0 0 unless ref $other or &looks_like_number($other)
582 0 0 unless ref $other or &looks_like_number($other)
588 0 0 unless ref $other or &looks_like_number($other)
594 0 0 unless ref $other or &looks_like_number($other)
600 0 0 unless ref $other or &looks_like_number($other)
606 0 266 unless ref $other or &looks_like_number($other)
612 8 67 if (which($self % 86400000000 != 0)->nelem == 0) { }
4 63 elsif (which($self % 60000000 != 0)->nelem == 0) { }
2 61 elsif (which($self % 1000000 != 0)->nelem == 0) { }
2 59 elsif (which($self % 1000 != 0)->nelem == 0) { }
643 0 4 $up ? :
4 3 if $yflag
644 0 0 $up ? :
0 7 if $qflag
645 0 7 $up ? :
663 0 0 unless my $rv = eval { do { 'Time::Moment'->from_epoch($ts, $us * 1000)->to_string('reduced', 1) } }
684 1 0 if (ref $val eq 'ARRAY' and not ref $val->[0]) { }
0 0 elsif (ref $val eq 'ARRAY') { }
700 1 647 if $v =~ /^\d\d\d\d-\d\d-\d\d$/
702 0 647 if $v =~ /^\d\d\d\d-\d\d-\d\d[ T]\d\d:\d\d$/
704 589 58 if $v =~ /^\d\d\d\d-\d\d-\d\d[ T]\d\d:\d\d:\d\d(\.\d+)?$/
711 32 604 if (ref $dt eq 'ARRAY') { }
715 0 600 if ($inplace) { }
716 0 0 ref $_ ? :
0 0 if ref $_ ne 'ARRAY'
722 32 0 if not $inplace
725 0 604 if (&looks_like_number($dt)) { }
604 0 elsif (not ref $dt) { }
0 0 elsif (ref $dt eq 'DateTime' or ref $dt eq 'Time::Piece') { }
0 0 elsif (ref $dt eq 'Time::Moment') { }
729 0 604 $dt eq 'now' ? :
737 0 604 unless $tm
744 0 879 unless defined $v
745 111 768 if (ref $v eq 'ARRAY') { }
768 0 elsif (not ref $v) { }
749 763 0 if ($inplace) { }
750 763 0 if ref $_ ne 'ARRAY'
756 0 111 if not $inplace
760 0 768 unless defined $tm
761 0 768 if ($fmt eq 'Time::Moment') { }
785 21 10 if (defined $delta_m)