Branch Coverage

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


line true false branch
39 102 1551 ref $class ? :
47 1 9 if ref $data eq 'PDL::DateTime'
51 1 8 if (ref $data eq 'ARRAY') { }
8 0 elsif (ref $data eq 'PDL') { }
55 8 0 if ($data->type == longlong()) { }
0 0 elsif ($data->type == double()) { }
72 0 0 if (&looks_like_number($data)) { }
0 0 elsif ($data) { }
100 1 2 if ref $ep eq 'ARRAY'
109 1 2 if ref $rd eq 'ARRAY'
119 1 2 if ref $sd eq 'ARRAY'
129 1 2 if ref $jd eq 'ARRAY'
145 0 3 unless defined $y and defined $m and defined $d
147 1 2 if ref $y eq 'ARRAY'
148 1 2 if ref $d eq 'ARRAY'
149 1 2 if ref $m eq 'ARRAY'
150 1 2 if ref $H eq 'ARRAY'
151 1 2 if ref $M eq 'ARRAY'
152 1 2 if ref $S eq 'ARRAY'
153 1 2 if ref $U eq 'ARRAY'
156 2 1 if defined $H
157 2 1 if defined $M
158 2 1 if defined $S
160 2 1 if defined $U
175 0 44 unless defined $count and defined $unit
176 5 39 unless defined $step
178 0 44 $start eq 'now' ? :
180 5 39 if ($unit eq 'year')
186 0 44 if ($unit eq 'quarter')
192 12 32 if ($unit eq 'month') { }
27 5 elsif (my $inc = $INC_SECONDS{$unit}) { }
306 16 32 if ($self->is_inplace) { }
310 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}) { }
336 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}) { }
361 8 16 if ($self->is_inplace) { }
363 0 8 unless defined $unit
364 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}) { }
378 1 4 $unit eq 'week' ? :
379 0 5 if $up and $unit eq 'week'
385 0 16 unless defined $unit
386 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}) { }
399 2 8 $unit eq 'week' ? :
400 0 10 if $up and $unit eq 'week'
408 5 0 &looks_like_number($_[-1]) ? :
410 5 0 if not $fmt or $fmt eq 'auto'
422 70 43 if not $fmt or $fmt eq 'auto'
423 1 112 if ($fmt eq 'epoch') { }
1 111 elsif ($fmt eq 'epoch_int') { }
438 0 0 if $self->nelem == 1
440 0 0 unless $unit
441 0 0 if $unit eq 'week'
442 0 0 if $unit eq 'day'
443 0 0 if $unit eq 'hour'
444 0 0 if $unit eq 'minute'
445 0 0 if $unit eq 'second'
446 0 0 if $unit eq 'millisecond'
452 0 0 unless $self->is_increasing or $self->is_decreasing
454 0 0 if $freq eq 'BAD' or $freq < 0
455 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) { }
500 0 0 unless $unit
501 0 0 unless $self->ndims == 1
502 0 0 unless $self->is_increasing
508 0 0 unless $unit
509 0 0 unless $self->ndims == 1
510 0 0 unless $self->is_increasing
513 0 0 if ($end->nelem == 0) { }
517 0 0 unless $end->at($end->nelem - 1) == $end->nelem - 1
524 0 0 unless $unit
525 0 0 unless $self->ndims == 1
526 0 0 unless $self->is_increasing
529 0 0 if $end->nelem > 1
535 0 0 unless $unit
541 0 0 if $strictly
547 0 0 if $strictly
570 1 0 $self->ndims > 0 ? :
578 0 0 unless ref $other or &looks_like_number($other)
584 0 0 unless ref $other or &looks_like_number($other)
590 0 0 unless ref $other or &looks_like_number($other)
596 0 0 unless ref $other or &looks_like_number($other)
602 0 0 unless ref $other or &looks_like_number($other)
608 0 266 unless ref $other or &looks_like_number($other)
614 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) { }
645 0 4 $up ? :
4 3 if $yflag
646 0 0 $up ? :
0 7 if $qflag
647 0 7 $up ? :
665 0 0 unless my $rv = eval { do { 'Time::Moment'->from_epoch($ts, $us * 1000)->to_string('reduced', 1) } }
686 1 0 if (ref $val eq 'ARRAY' and not ref $val->[0]) { }
0 0 elsif (ref $val eq 'ARRAY') { }
702 1 647 if $v =~ /^\d\d\d\d-\d\d-\d\d$/
704 0 647 if $v =~ /^\d\d\d\d-\d\d-\d\d[ T]\d\d:\d\d$/
706 589 58 if $v =~ /^\d\d\d\d-\d\d-\d\d[ T]\d\d:\d\d:\d\d(\.\d+)?$/
713 32 604 if (ref $dt eq 'ARRAY') { }
717 0 600 if ($inplace) { }
718 0 0 ref $_ ? :
0 0 if ref $_ ne 'ARRAY'
724 32 0 if not $inplace
727 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') { }
731 0 604 $dt eq 'now' ? :
739 0 604 unless $tm
746 0 879 unless defined $v
747 111 768 if (ref $v eq 'ARRAY') { }
768 0 elsif (not ref $v) { }
751 763 0 if ($inplace) { }
752 763 0 if ref $_ ne 'ARRAY'
758 0 111 if not $inplace
762 0 768 unless defined $tm
763 0 768 if ($fmt eq 'Time::Moment') { }
787 21 10 if (defined $delta_m)