Branch Coverage

blib/lib/Math/Expression.pm
Criterion Covered Total %
branch 314 394 79.7


line true false branch
164 18 0 if (defined $self->{'PrintErrFunc'} and $self->{'PrintErrFunc'})
183 0 1000 if (not defined $name) { }
186 25 975 if ($name =~ /^(.+)\[(\d+)\]$/) { }
187 2 23 if (not defined $self->{'VarHash'}{$1}) { }
1 22 elsif ($2 > $self->{'ArrayMaxIndex'}) { }
0 22 elsif ($2 > @{$self->{'VarHash'}{$1};}) { }
188 1 1 if ($2 == 0) { }
228 0 0 unless exists $self->{'VarHash'}{$name}
238 0 0 exists $self->{'VarHash'}{$name} ? :
266 45 4770 if ($GenSemiColon) { }
1551 3219 elsif ($EndInput) { }
755 2464 elsif ($expr =~ s/^(((\d+(\.\d*)?)|(\.\d+))([ed][-+]?\d+)?)//i) { }
107 2357 elsif ($expr =~ /^(['"])/ and $expr =~ s/^($1)([^$1]*)$1//) { }
45 2312 elsif ($expr =~ s/^}//) { }
1387 925 elsif ($expr =~ s"^(\+\+|--|:=|>=|<=|==|<>|!=|&&|\|\||lt\b|gt\b|le\b|ge\b|eq\b|ne\b|\*\*|[-~!./*%+,<>\?:\(\)\[\]{])"") { }
51 874 elsif ($expr =~ s/^(if|while)//) { }
167 707 elsif ($expr =~ s/^;//) { }
72 635 elsif ($expr =~ s/^([_a-z][\w]*)\(/(/i) { }
634 1 elsif ($expr =~ s/^\$?([_a-z]\w*)//i) { }
275 1028 523 if ($endAlready) { }
293 3 1 defined $2 ? :
3 4 length $1 == 1 ? :
88 19 if $1 eq '"'
306 69 1318 if ($operlast and defined $MonOp{$1})
310 25 1362 if (defined $MonVarOp{$1})
315 5 1382 if ($ln eq '(' and $1 eq ')') { }
318 1140 242 unless $1 eq ')' or $1 eq ']'
331 1 71 unless ($self->{'Functions'}{$1})
341 0 0 defined $2 ? :
634 0 defined $1 ? :
349 514 4299 if (not @operators and $EndInput)
354 3785 514 $newt ? :
363 0 5436 if ($EndInput and @operators == 0)
364 0 0 if (@tree != 1)
365 0 0 $#tree == -1 ? :
373 1496 3426 if ($newt and $newt->{'oper'} eq 'var' || $newt->{'oper'} eq 'const')
374 1074 422 if @operators
381 200 2100 if ($newt and @operators and $operators[-1]{'oper'} eq '(' and $newt->{'oper'} eq ')')
382 0 200 if ($EndInput and $#operators != 0)
392 0 514 unless ($newt or $EndInput)
393 0 0 if ($loopb++ > 40)
401 3226 514 $newt ? :
406 2100 1640 if ($newt and @operators)
407 0 2100 unless defined $NewOpPrec
408 0 2100 unless defined $OperPrec{$operators[-1]{'oper'}}[0]
410 1954 1272 if ($newt and !@operators || @operators && $NewOpPrec > $OperPrec{$operators[-1]{'oper'}}[0])
411 828 1126 if @operators
417 35 8 if (@operators and $operators[-1]{'oper'} eq 'flow' and $newt and $newt->{'oper'} ne ';' and $newt->{'oper'} ne 'EOF' and $newt->{'oper'} ne '}')
418 35 0 if @operators
425 1751 0 if (@operators and $NewOpPrec <= $OperPrec{$operators[-1]{'oper'}}[0])
429 79 1672 if ($operators[-1]{'oper'} eq ';' and not defined $operators[-1]{'after'})
435 44 1114 if (@operators and $newt and $operators[-1]{'oper'} eq '{' and $newt->{'oper'} eq '}')
439 9 35 unless @operators and $operators[-1]{'oper'} eq 'flow'
449 215 1448 $func | $monop | $flow ? :
523 1140 unless (@tree >= ($func | $monop | $flow ? 1 : 2))
451 512 11 if $op->{'oper'} eq ';' or $op->{'oper'} eq 'EOF'
454 1 10 $expr ne '' ? :
461 978 162 unless ($monop or $func)
466 3 1137 if $op->{'oper'} eq 'EOF'
470 45 1057 if $newt and $op->{'oper'} eq '[' and $newt->{'oper'} eq ']'
472 83 1057 unless $newt
492 13 2621 unless defined $tree
494 1487 1134 if $tree->{'oper'} eq 'var' or $tree->{'oper'} eq 'const'
498 0 1134 if (defined $MatchOp{$tree->{'oper'}} or defined $MatchOpClose{$tree->{'oper'}})
503 1 23 if (defined $MonVarOp{$tree->{'oper'}} and !defined($tree->{'right'}) || $tree->{'right'}{'oper'} ne '[' && $tree->{'right'}{'oper'} ne 'var')
508 1 1133 if ($tree->{'oper'} eq '?' and $tree->{'right'}{'oper'} ne ':')
509 1 0 unless $ChkErrs
513 1064 70 if ($tree->{'oper'} ne 'func')
514 0 1064 unless (not defined $tree->{'left'} and defined $tree->{'monop'} or $self->CheckTree($tree->{'left'}))
515 0 0 defined $tree->{'monop'} ? :
0 0 unless $ChkErrs
519 0 1134 unless (&CheckTree($self, $tree->{'right'}))
520 0 0 defined $tree->{'monop'} ? :
0 0 unless $ChkErrs
524 70 1064 if ($tree->{'oper'} eq 'func')
526 0 0 if ($InFunLV{$fname} and !defined($tree->{'right'}{'oper'}) || $tree->{'right'}{'oper'} ne 'var' && $tree->{'right'}{'oper'} ne ',' && (!defined($tree->{'right'}{'left'}{'oper'}) || $tree->{'right'}{'left'}{'oper'} ne 'var'))
533 2 1132 unless $ok
534 1132 2 $ok ? :
554 0 0 unless defined $dl
557 0 0 unless (defined $nodp)
565 0 0 if ($nodp->{'oper'} eq 'var') { }
0 0 elsif ($nodp->{'oper'} eq 'const') { }
601 0 1 unless $tree
628 0 3571 unless defined $tree
632 1041 2530 if $oper eq 'const'
633 381 575 $wantlv ? :
956 1574 if $oper eq 'var'
637 70 1504 if $oper eq 'func'
639 113 1391 if ($oper eq '++' or $oper eq '--')
642 7 106 if ($tree->{'right'}{'oper'} eq '[') { }
651 0 7 unless ($index =~ /^-?\d+$/)
656 4 3 if $index < 0
658 2 5 if $index < 0 or $index > @left
668 70 41 $oper eq '++' ? :
676 68 1323 if (not defined $tree->{'left'} and defined $tree->{'monop'})
682 0 68 unless (defined $right)
683 0 0 unless ($self->{'AutoInit'})
690 0 68 unless ($right =~ /^([-+]?)0*([\d.]+)([ef][-+]?\d*|)$/i)
696 57 11 if $oper eq '-'
697 11 0 if $oper eq '+'
698 0 0 if $oper eq '!'
699 0 0 if $oper eq '~'
708 360 963 if ($oper eq ':=')
713 314 46 if $#right <= 0
718 1 51 if $i > $#right
720 44 7 if ($i == $#left and $i != $#right)
731 78 885 if ($oper eq 'flow')
732 56 22 if ($tree->{'flow'} eq 'if')
735 34 22 $left[-1] ? :
737 22 0 if ($tree->{'flow'} eq 'while')
739 0 22 unless ($self->{'PermitLoops'})
744 0 121 if ($self->{'MaxLoopCount'} and ++$self->{'LoopCount'} > $self->{'MaxLoopCount'})
750 22 99 unless $left[-1]
761 0 2 if (not defined $left and $oper ne ',' and $oper ne '.' and $oper ne ';')
762 0 0 unless ($self->{'AutoInit'})
771 5 7 $left ? :
12 873 if $oper eq '?'
774 12 861 if $oper eq ',' and $wantlv
777 10 851 if ($oper eq '&&' or $oper eq '||')
778 2 8 if $oper eq '&&' and not $left
779 2 6 if $oper eq '||' and $left
783 3 3 $right[$#right] ? :
790 121 730 if $oper eq ','
791 211 519 if $oper eq ';'
795 38 481 if ($oper eq '[')
797 0 38 unless $right =~ /^-?\d+$/
799 20 18 if $wantlv
802 11 27 if $index < 0
804 20 18 if $wantlv
808 2 16 if $index < 0 or $index > @left
817 14 467 if ($oper eq '.')
819 2 12 unless defined $left
820 0 14 unless defined $right
821 0 14 if (length($left) + length($right) > $self->{'StringMaxLength'})
828 0 467 unless (defined $right)
829 0 0 unless ($self->{'AutoInit'})
836 2 2 $left lt $right ? :
4 463 if $oper eq 'lt'
837 1 5 $left gt $right ? :
6 457 if $oper eq 'gt'
838 2 1 $left le $right ? :
3 454 if $oper eq 'le'
839 2 1 $left ge $right ? :
3 451 if $oper eq 'ge'
840 1 1 $left eq $right ? :
2 449 if $oper eq 'eq'
841 2 2 $left ne $right ? :
4 445 if $oper eq 'ne'
843 0 445 if $oper eq ':'
849 0 445 if (not $left =~ /^([-+]?)0*([\d.]+)([ef][-+]?\d*|)/i) { }
850 0 0 unless ($self->{'AutoInit'} and $left eq '')
859 1 444 if (not $right =~ /^([-+]?)0*([\d.]+)([ef][-+]?\d*|)/i) { }
860 1 0 unless ($self->{'AutoInit'} and $right eq '')
869 69 375 if $oper eq '*'
870 12 363 if $oper eq '/'
871 22 341 if $oper eq '%'
872 120 221 if $oper eq '+'
873 36 185 if $oper eq '-'
874 4 181 if $oper eq '**'
877 64 17 $left > $right ? :
81 100 if $oper eq '>'
878 40 12 $left < $right ? :
52 48 if $oper eq '<'
879 2 1 $left >= $right ? :
3 45 if $oper eq '>='
880 2 1 $left <= $right ? :
3 42 if $oper eq '<='
881 21 16 $left == $right ? :
37 5 if $oper eq '=='
882 2 1 $left != $right ? :
3 2 if $oper eq '!='
883 1 1 $left != $right ? :
2 0 if $oper eq '<>'
895 8 62 if defined $self->{'ExtraFuncEval'} and defined($res = $self->{'ExtraFuncEval'}->(@_))
899 6 56 if $fname eq 'int'
900 6 50 if $fname eq 'abs'
903 4 7 $self->{'RoundNegatives'} ? :
11 39 if $fname eq 'round'
905 4 35 if $fname eq 'split'
906 3 32 if $fname eq 'join'
909 1 31 if ($fname eq 'printf')
910 0 1 unless ($self->{'EnablePrintf'})
915 1 0 if length $s <= $self->{'StringMaxLength'}
920 1 30 if $fname eq 'mktime'
921 2 28 if $fname eq 'strftime'
922 2 26 if $fname eq 'localtime'
924 2 24 if $fname eq 'defined'
926 7 17 if ($fname eq 'pop' or $fname eq 'shift')
928 6 1 $fname eq 'pop' ? :
934 5 12 if ($fname eq 'push' or $fname eq 'unshift')
941 2 3 $fname eq 'push' ? :
947 1 11 if $fname eq 'strlen'
948 7 4 if $fname eq 'count'
951 4 0 if ($fname eq 'aindex')
954 3 22 if $val eq $arglist[$inx]
1004 0 9 unless exists $$self{$_[0]}
1005 0 9 unless defined $_[1]