Branch Coverage

lib/Date/Manip/Delta.pm
Criterion Covered Total %
branch 218 272 80.1


line true false branch
91 0 3422 if ($self->{'err'})
92 0 0 if wantarray
101 3083 339 if wantarray
130 120 4868 if (ref $args[0] eq 'HASH') { }
134 15 4853 if (@args == 3) { }
135 15 0 $args[2] ? :
149 0 5164 if lc $key eq "normal"
151 5154 10 if (lc $key eq 'delta' or lc $key eq 'business' or lc $key eq 'standard' or lc $key eq 'nonorm' or lc $key eq 'mode' or lc $key eq 'type') { }
9 1 elsif ($key =~ /^[yMwdhms]$/) { }
158 1 5153 if (exists $opts{lc $key})
176 2 4984 if (exists $opts{'delta'} + exists $opts{'business'} + exists $opts{'standard'} + (exists $opts{'y'} || exists $opts{'M'} || exists $opts{'w'} || exists $opts{'d'} || exists $opts{'h'} || exists $opts{'m'} || exists $opts{'s'}) > 1)
187 1 4983 if (exists $opts{'mode'} and not $opts{'mode'} =~ /^(business|standard)$/)
191 1 4982 if (exists $opts{'type'} and not $opts{'type'} =~ /^(exact|semi|estimated|approx)$/)
197 1 4981 if (exists $opts{'business'} + exists $opts{'standard'} + exists $opts{'mode'} > 1) { }
166 4815 elsif (exists $opts{'business'}) { }
8 4807 elsif (exists $opts{'standard'}) { }
215 4938 43 if (exists $opts{'delta'}) { }
216 1 4937 if (ref $opts{'delta'} ne "ARRAY")
235 229 4751 exists $opts{'mode'} ? :
237 229 4751 exists $opts{'mode'} ? :
238 57 4923 exists $opts{'nonorm'} ? :
241 94 4886 if (exists $opts{'type'}) { }
256 8 34840 if (exists $opts{$opt})
257 1 7 if (ref $opts{$opt})
262 1 6 unless ($dmb->_is_num($val))
272 4972 6 unless $field_set
274 0 6 if ($self->{'err'})
284 11 4967 if ($err)
298 2 4965 if ($err)
322 2017 84 if exists $dmb->{'data'}{'rx'}{'delta'}{$rx}
324 26 58 if ($rx eq 'expanded') { }
32 26 elsif ($rx eq 'mode') { }
26 0 elsif ($rx eq 'when') { }
369 0 773 if (ref $args[0] eq 'HASH') { }
377 0 773 if (@args == 2) { }
1 772 elsif (@args == 1) { }
0 772 elsif (@args) { }
379 0 0 if ($business eq 'standard' or not $business) { }
385 0 0 $no_normalize ? :
389 0 1 if ($arg eq 'standard') { }
1 0 elsif ($arg eq 'business') { }
0 0 elsif ($arg eq 'nonormalize') { }
0 0 elsif ($arg) { }
411 0 773 unless ($instring)
434 260 513 unless $err
444 174 836 if ($string =~ s/\s*$moderx\s*//i)
446 1 173 if ($dmb->{'data'}{'wordmatch'}{'mode'}{lc $m} == 1) { }
454 89 85 unless $err
464 50 744 if ($string and $string =~ s/$whenrx//i)
467 16 34 if ($dmb->{'data'}{'wordmatch'}{'when'}{lc $when} == 1)
473 114 680 if ($string and $string =~ /$rx/)
477 660 138 if (not defined $f) { }
4 134 elsif (exists $dmb->{'data'}{'wordmatch'}{'nth'}{lc $f}) { }
487 12 102 if ($past)
498 310 463 unless (@delta)
506 0 130 if ($mode and exists $opts{'mode'} and $mode ne $opts{'mode'})
511 1 462 if exists $opts{'mode'}
512 332 131 unless $mode
517 0 463 exists $opts{'nonorm'} ? :
526 0 463 if ($err)
534 463 0 $mode || exists $opts{'mode'} ? :
538 0 463 $opts{'nonorm'} ? :
545 0 2350 if ($self->{'err'})
556 268 2544 if ($in =~ s/^([^%]+)//) { }
1 2543 elsif ($in =~ s/^%%//) { }
18 2525 elsif ($in =~ s/^% (\+)? # sign ([<>0])? # pad (\d+)? # width ([yMwdhms]) # field v # type //ox) { }
2503 22 elsif ($in =~ s/^(% (\+)? # sign ([<>0])? # pad (\d+)? # width (?:\.(\d+))? # precision ([yMwdhms]) # field ([yMwdhms]) # field0 ([yMwdhms]) # field1 )//ox) { }
6 16 elsif ($in =~ s/^% (\+)? # sign ([<>])? # pad (\d+)? # width Dt //ox) { }
16 0 elsif ($in =~ s/^(% (\+)? # sign ([<>])? # pad (\d+)? # width D ([yMwdhms]) # field0 ([yMwdhms]) # field1 )//ox) { }
594 0 2503 if (not @field) { }
630 0 16 if (not @field) { }
645 58 2292 if (wantarray) { }
2292 0 elsif (@out == 1) { }
666 13 141 if ($f < 0) { }
116 25 elsif ($f > 0) { }
689 3 19 if ($field0 eq $field1) { }
4 15 elsif ($mode eq 'business') { }
694 3 1 if ($f0 <= 1)
702 1 2 $f1 == 1 ? :
705 2 2 if ($f0 == 2)
713 0 2 $f1 == 2 ? :
716 3 1 if ($f0 <= 6)
722 14 1 if ($f0 <= 1)
730 2 12 $f1 == 1 ? :
733 13 2 if ($f0 <= 3)
741 7 6 if ($f1 <= 3) { }
750 6 9 if ($f0 <= 6)
763 16 28 if (defined $sign and $sign eq '+') { }
777 3 19 if ($width and length $ret < $width)
778 1 2 if (defined $pad and $pad eq '>') { }
792 2483 38 unless defined $pad
798 66 2455 if ($val < 0) { }
16 2439 elsif ($sign) { }
807 222 2299 if (defined $precision) { }
0 2299 elsif (defined $width) { }
812 0 0 if (length $i < $width)
820 38 2483 if ($width) { }
821 8 30 if ($pad eq '>') { }
15 15 elsif ($pad eq '<') { }
823 6 2 $width > length $val ? :
828 10 5 $width > length $val ? :
832 11 4 $width > length($val) - length($s) ? :
848 1516 0 unless (exists $self->{'data'}{'f'}{'y'} or exists $self->{'data'}{'f'}{'y'}{'y'})
863 18 2503 unless (@field)
869 1510 993 unless (exists $self->{'data'}{'flen'}{'s'})
889 9372 7469 unless (exists $self->{'data'}{'f'}{$f}{$field})
893 9033 339 unless (exists $self->{'data'}{'f'}{$f}{'s'})
914 33 21 if ($op eq "business" or $op eq "standard")
916 16 17 $self->{'data'}{'mode'} eq $op ? :
919 7 14 $self->{'data'}{'type'} eq $op ? :
924 0 29 if ($self->{'err'})
929 0 29 if (ref $obj eq 'Date::Manip::Date') { }
29 0 elsif (ref $obj eq 'Date::Manip::Delta') { }
930 0 0 if ($obj->{'err'})
937 0 29 if ($obj->{'err'})
951 27 2 if $type1 eq $type2
953 2 4 if $type1 eq $type or $type2 eq $type
965 0 29 if (@args > 2)
970 0 29 if (@args == 2) { }
4 25 elsif (@args == 1) { }
973 0 4 if ($args[0] eq 'nonormalize') { }
985 0 29 if ($self->{'data'}{'mode'} ne $delta->{'data'}{'mode'})
993 28 175 if ($subtract) { }
1036 19 43 if $from_val == $to_val
1042 35 8 if ($from_val < $to_val)
1072 4 4 if ($mode eq 'business') { }
1074 0 4 if ($to eq 'estimated') { }
1 3 elsif ($to eq 'approx' or $to eq 'semi') { }
1087 0 4 if ($to eq 'estimated') { }
1 3 elsif ($to eq 'approx' or $to eq 'semi') { }
1112 0 3 if ($self->{'err'})
1117 0 3 if (!ref($delta) eq "Date::Manip::Delta")
1121 0 3 if ($delta->{'err'})
1126 0 3 if ($self->{'data'}{'mode'} ne $delta->{'data'}{'mode'})
1138 3 0 if ($self->{'data'}{'length'} eq "unknown")
1146 3 0 if ($delta->{'data'}{'length'} eq "unknown")