Branch Coverage

blib/lib/Math/Symbolic/Custom/Collect.pm
Criterion Covered Total %
branch 437 602 72.5


line true false branch
164 0 681 unless defined wantarray
169 0 681 unless (defined $t2)
174 173 508 if ($t2->term_type == 0 and $t2->type == 3) { }
183 173 0 if (defined $c_n_cth and defined $c_d_cth) { }
188 0 0 if (defined $c_n)
192 0 0 if (defined $c_d)
199 11 162 if ($denominator->term_type == 1 and $denominator->value == 1) { }
0 162 elsif ($denominator->term_type == 1 and $denominator->value == 0) { }
200 2 9 wantarray ? :
210 9 153 if (defined $Im and not $Im->term_type == 1 && $Im->value == 0) { }
223 0 9 wantarray ? :
228 21 132 wantarray ? :
235 498 10 if (defined $collected) { }
236 247 251 wantarray ? :
255 0 186 unless defined wantarray
259 0 186 unless defined $t2
262 0 186 if (exists $d_hr->{'terms'} and exists $n_hr->{'terms'}) { }
186 0 elsif (exists $n_hr->{'terms'}) { }
270 0 0 unless defined $const_acc
271 0 0 if $const_acc != 0
277 0 0 if defined $expr2
288 0 186 unless defined $const_acc
289 159 27 if $const_acc != 0
299 0 186 if (scalar @terms == 0)
303 186 0 wantarray ? :
336 0 0 unless (defined $var)
338 0 0 if (scalar @vars == 1) { }
347 0 0 unless defined $t2
349 0 0 unless ref($var) =~ /^Math::Symbolic::Variable/
412 14 19 unless ref($Re) =~ /^Math::Symbolic/
413 14 19 unless ref($Im) =~ /^Math::Symbolic/
443 0 186 if (scalar @terms == 0)
454 32 203 if (scalar @cvar) { }
464 3 183 if (scalar @Re == 0) { }
476 155 31 if (scalar @Im == 0)
492 31 31 unless defined $hr
496 0 31 if scalar @vars == 0
507 35 28 if (scalar @n_ss) { }
519 0 31 if (defined $dhr) { }
578 0 0 if (exists $VARIABLE_CONSTRAINTS{$var})
593 0 0 if (exists $VARIABLE_CONSTRAINTS{$var})
621 0 0 if (exists $VARIABLE_CONSTRAINTS{$var})
632 0 3 if (exists $VARIABLE_CONSTRAINTS{$var}{$constraint})
663 123 50 if $n_acc != 0
664 149 24 if $d_acc != 0
670 173 0 if (scalar @con == scalar @con_int)
678 839 135 if ($num % $div != 0)
683 27 839 if ($div_ok)
689 27 146 if (defined $GCF)
698 18 155 if ($n_acc == 0 and $d_acc == 0)
710 80 4 if ($v =~ /^CONST/ or $v =~ /^VAR/)
712 40 40 if (exists $c_pow{$v}) { }
713 3 37 if ($c_pow{$v} > $c)
728 12 28 if ($c == scalar(keys %n_terms) + scalar(keys %d_terms))
730 2 10 if ($v =~ /^CONST/) { }
10 0 elsif ($v =~ /^VAR/) { }
734 10 0 if ($n_funcs{$v}{'name'} ne $COMPLEX_VAR)
756 18 9 if ($vv eq $v) { }
757 2 16 if ($num_d_terms == 1 and $cc == 1 and $v =~ /^VAR/ and not test_constraint($d_funcs{$v}{'name'}, 'nonzero')) { }
763 0 16 if ($cc < $c_sub)
767 5 11 if ($cc > 0) { }
3 8 elsif (scalar @v1 == 1) { }
781 15 3 if (scalar @nt)
786 7 5 if ($did_some_cancellation)
794 10 3 if ($vv eq $v) { }
796 0 10 if ($cc < $c_sub)
800 3 7 if ($cc > 0) { }
5 2 elsif (scalar @v1 == 1) { }
811 5 5 if (scalar @nt)
825 147 0 unless $n_key =~ /\A CONST_(\d+):(\d+) \z/msx
830 0 0 if ($result < $EXP_MAX)
838 57 0 unless $d_key =~ /\A CONST_(\d+):(\d+) \z/msx
843 0 0 if ($result < $EXP_MAX)
849 92 81 if (scalar keys %n_terms == 0 and scalar keys %d_terms == 0)
851 18 74 if ($d_acc < 0)
857 92 0 if ($n_acc == int $n_acc and $d_acc == int $d_acc)
871 115 58 if ($did_some_cancellation)
889 844 10 if ($ok)
891 844 0 if (defined $ct_href)
902 147 1907 if ($tree->term_type == 2) { }
539 1368 elsif ($tree->term_type == 1) { }
32 1336 elsif ($tree->term_type == 0 and $tree->arity == 1) { }
1 1335 elsif ($tree->term_type == 0 and $tree->type == 8) { }
719 616 elsif ($tree->term_type == 0 and $tree->type == 2) { }
600 16 elsif ($tree->term_type == 0 and $tree->type == 0) { }
0 16 elsif ($tree->term_type == 0 and $tree->type == 1) { }
16 0 elsif ($tree->term_type == 0 and $tree->type == 7) { }
904 147 0 if ($s eq '+') { }
0 0 elsif ($s eq '-') { }
914 539 0 if ($s eq '+') { }
0 0 elsif ($s eq '-') { }
927 32 0 if (defined $ctree)
931 32 0 if ($s eq '+') { }
0 0 elsif ($s eq '-') { }
945 1 0 if (defined $ctree1 and defined $ctree2)
950 1 0 if ($s eq '+') { }
0 0 elsif ($s eq '-') { }
964 713 6 if ($ok1 and $ok2)
965 0 713 if ($s eq "-")
987 0 16 if ($op1->term_type == 2 and $exp->term_type == 1 and $exp->value eq int $exp->value and $exp->value > 0) { }
12 4 elsif ($op1->term_type == 1 and $exp->term_type == 1 and $exp->value eq int $exp->value and $exp->value > 0) { }
996 0 0 if ($s eq "-")
1010 4 8 if ($result < $EXP_MAX) { }
1021 0 12 if ($s eq "-")
1035 1250 1150 if ($tree->term_type == 2) { }
561 589 elsif ($tree->term_type == 1) { }
94 495 elsif ($tree->term_type == 0 and $tree->arity == 1) { }
0 495 elsif ($tree->term_type == 0 and $tree->type == 8) { }
0 495 elsif ($tree->term_type == 0 and $tree->type == 4 and $tree->op1->term_type == 1) { }
10 485 elsif ($tree->term_type == 0 and $tree->type == 7) { }
481 4 elsif ($tree->term_type == 0 and $tree->type == 2) { }
1046 94 0 if (defined $ctree)
1056 0 0 if (defined $ctree2 and defined $ctree1)
1073 0 10 if ($op1->term_type == 2 and $exp->term_type == 1 and $exp->value eq int $exp->value and $exp->value > 0) { }
4 6 elsif ($op1->term_type == 1 and $exp->term_type == 1 and $exp->value eq int $exp->value and $exp->value > 0) { }
1089 0 4 if ($result < $EXP_MAX) { }
1122 539 905 if ($e->{'type'} eq 'constant') { }
147 758 elsif ($e->{'type'} eq 'variable') { }
33 725 elsif ($e->{'type'} eq 'function') { }
725 0 elsif ($e->{'type'} eq 'products') { }
1123 539 0 if ($e->{'object'}->special eq '') { }
1129 0 0 if ($e->{'object'}->is_identical($trees{$n}))
1134 0 0 unless (defined $name)
1145 5 10 if ($e->{'object'}->is_identical($trees{$n}))
1150 142 5 unless (defined $name)
1160 0 4 if ($e->{'object'}->is_identical($trees{$n}))
1165 33 0 unless (defined $name)
1175 2755 1344 if $_->{'type'} eq "constant"
1176 4 721 if (scalar @con_list == scalar @list) { }
1185 2751 1344 if ($l->{'type'} eq 'constant') { }
1250 94 elsif ($l->{'type'} eq 'variable') { }
94 0 elsif ($l->{'type'} eq 'function') { }
1186 557 2194 if ($l->{'object'}->special eq '') { }
1192 2186 0 if ($l->{'object'}->is_identical($trees{$n}))
1197 8 2186 unless (defined $name)
1208 855 876 if ($l->{'object'}->is_identical($trees{$n}))
1213 395 855 unless (defined $name)
1223 44 38 if ($l->{'object'}->is_identical($trees{$n}))
1228 50 44 unless (defined $name)
1254 131 391 if ($trees{$k}{'name'} eq $COMPLEX_VAR)
1261 131 713 if ($contains_complex)
1270 43 144 if ($vv eq $complex_name and $cc > 1 and $cc == int $cc) { }
1273 2 41 if ($pmod == 0) { }
2 39 elsif ($pmod == 1) { }
30 9 elsif ($pmod == 2) { }
9 0 elsif ($pmod == 3) { }
1274 2 0 if (scalar @v1 == 1)
1283 30 0 if (scalar @v1 == 1)
1296 145 32 if (scalar @nt)
1298 8 137 if (exists $c_ct_new{$nk}) { }
1321 1824 156 if ($tn =~ /^VAR/)
1324 1824 0 if (exists $thr->{$n})
1345 655 526 if (scalar @zero == scalar @coeffs)
1352 0 529 unless length get_term_name($a, \%trees) <=> length get_term_name($b, \%trees) or get_term_name($a, \%trees) cmp get_term_name($b, \%trees)
1357 106 420 if (scalar @negative == scalar @sorted_terms)
1363 71 455 if ($accumulator > 0) { }
44 411 elsif ($accumulator < 0) { }
1374 6 832 if $const == 0
1378 65 767 if ($all_neg and $c == 0 and $accumulator == 0) { }
177 590 elsif ($const < 0) { }
1385 363 469 if ($const != 1)
1393 0 1123 if $pow == 0
1395 1123 0 if (exists $trees{$var}) { }
1396 930 193 if ($pow == 1) { }
1418 420 106 unless $all_neg
1422 11 515 if ($first->[0] eq "-")
1423 11 0 if ($first->[1]->term_type == 1 and $first->[1]->special eq '') { }
1435 211 210 if ($e->[0] eq '+') { }
210 0 elsif ($e->[0] eq '-') { }
1451 305 68 $n < $d ? :
1454 55 3102 if ($n % $div == 0 and $d % $div == 0)
1466 11777 681 if (defined $d) { }
1474 5748 6710 if ($t->term_type == 0)
1480 3459 8999 if ($t->term_type == 2) { }
3251 5748 elsif ($t->term_type == 1) { }
5346 402 elsif ($op_arity == 2) { }
402 0 elsif ($op_arity == 1) { }
1486 3226 25 if ($val eq int $val or length $t->special) { }
1491 25 0 if (defined $frac and length $frac >= 1 and length $frac < 10) { }
1513 1551 3795 if ($t->type == 0) { }
205 3590 elsif ($t->type == 1) { }
485 3105 elsif ($t->type == 3) { }
2924 181 elsif ($t->type == 2) { }
5 176 elsif ($t->type == 8) { }
176 0 elsif ($t->type == 7) { }
0 0 elsif ($t->type == 5 or $t->type == 6) { }
1514 95 1456 if ($op1->term_type == 1 and $op1->special eq '' and $op2->term_type == 1 and $op2->special eq '') { }
4 1452 elsif ($op1->term_type == 1 and $op1->value == 0) { }
0 1452 elsif ($op2->term_type == 1 and $op2->value == 0) { }
24 1428 elsif ($op1->term_type == 0 and $op1->type == 3 and $op2->term_type == 0 and $op2->type == 3) { }
10 1418 elsif ($op1->term_type == 0 and $op1->type == 3) { }
3 1415 elsif ($op2->term_type == 0 and $op2->type == 3) { }
1534 11 13 if ($denom_left->is_identical($denom_right)) { }
1568 54 151 if ($op1->term_type == 1 and $op1->special eq '' and $op2->term_type == 1 and $op2->special eq '') { }
0 151 elsif ($op2->term_type == 1 and $op2->value == 0) { }
0 151 elsif ($op1->term_type == 1 and $op1->value == 0) { }
19 132 elsif ($op1->term_type == 0 and $op1->type == 3 and $op2->term_type == 0 and $op2->type == 3) { }
3 129 elsif ($op1->term_type == 0 and $op1->type == 3) { }
4 125 elsif ($op2->term_type == 0 and $op2->type == 3) { }
1589 3 16 if ($denom_left->is_identical($denom_right)) { }
1625 0 485 if ($op2->term_type == 1 and $op2->value == 0) { }
4 481 elsif ($op1->term_type == 1 and $op1->value == 0) { }
7 474 elsif ($op2->term_type == 1 and $op2->value == 1) { }
0 474 elsif ($op1->term_type == 2 and $op2->term_type == 2 and $op1->name eq $op2->name and test_constraint($op1->name, 'nonzero')) { }
274 200 elsif ($op1->term_type == 1 and $op1->special eq '' and $op2->term_type == 1 and $op2->special eq '') { }
9 191 elsif ($op2->term_type == 1 and $op2->special eq '' and $op2->value < 0) { }
3 188 elsif ($op2->term_type == 0 and $op2->type == 2 and $op2->op1->term_type == 1 and $op2->op1->special eq '' and $op2->op1->value < 0) { }
0 188 elsif ($op2->term_type == 0 and $op2->type == 2 and $op2->op2->term_type == 1 and $op2->op2->special eq '' and $op2->op2->value < 0) { }
4 184 elsif ($op1->term_type == 0 and $op1->type == 3 and $op2->term_type == 0 and $op2->type == 3) { }
28 156 elsif ($op1->term_type == 0 and $op1->type == 3) { }
2 154 elsif ($op2->term_type == 0 and $op2->type == 3) { }
2 152 elsif ($op1->term_type == 0 and $op1->type == 7 and $op2->term_type == 0 and $op2->type == 7 and $op1->op1->is_identical($op2->op1)) { }
0 152 elsif ($op1->term_type == 0 and $op1->type == 7 and $op2->term_type == 1 and $op2->value != 0 and $op1->op1->term_type == 1 and $op1->op1->value == $op2->value) { }
1643 18 256 if ($op1->value / $op2->value eq int $op1->value / $op2->value) { }
256 0 elsif ($op1->value == int $op1->value and $op2->value == int $op2->value) { }
1715 2 2922 if ($op1->term_type == 1 and $op1->value == 0 or $op2->term_type == 1 and $op2->value == 0) { }
88 2834 elsif ($op1->term_type == 1 and $op1->value == 1) { }
17 2817 elsif ($op2->term_type == 1 and $op2->value == 1) { }
172 2645 elsif ($op1->term_type == 1 and $op1->special eq '' and $op2->term_type == 1 and $op2->special eq '') { }
16 2629 elsif ($op1->term_type == 0 and $op1->type == 3 and $op2->term_type == 0 and $op2->type == 3) { }
38 2591 elsif ($op1->term_type == 0 and $op1->type == 3) { }
37 2554 elsif ($op2->term_type == 0 and $op2->type == 3) { }
6 2548 elsif ($op1->term_type == 0 and $op1->type == 7 and $op2->term_type == 0 and $op2->type == 7 and $op1->op1->is_identical($op2->op1)) { }
0 2548 elsif ($op1->term_type == 0 and $op1->type == 7 and $op2->term_type == 1 || $op2->term_type == 2 and $op1->op1->is_identical($op2)) { }
2 2546 elsif ($op2->term_type == 0 and $op2->type == 7 and $op1->term_type == 1 || $op1->term_type == 2 and $op2->op1->is_identical($op1)) { }
183 2363 elsif ($op1->term_type == 0 and $op1->type == 0 || $op1->type == 1 or $op2->term_type == 0 and $op2->type == 0 || $op2->type == 1) { }
1781 181 2 if ($good)
1783 0 181 if $op2->term_type == 0 and $op2->type == 1
1787 179 4 if ($good) { }
1792 0 784 if $elem1->{'type'} eq "constant" and $elem1->{'object'}->value == 0
1793 0 784 if $elem2->{'type'} eq "constant" and $elem2->{'object'}->value == 0
1795 118 666 if (exists $elem1->{'list'} and exists $elem2->{'list'}) { }
185 481 elsif (exists $elem1->{'list'}) { }
216 265 elsif (exists $elem2->{'list'}) { }
1819 0 179 if (scalar @to_sum == 0) { }
1843 1 4 if ($op2->term_type == 1 and $op2->value == 1) { }
4 0 elsif ($op1->term_type == 1) { }
1849 0 4 if ($op1->value <= 0) { }
0 4 elsif ($op1->value == 1) { }
1 3 elsif ($op2->term_type == 1 and $op1->value == $op2->value) { }
1 2 elsif ($t->op2->term_type == 0 and $t->op2->type == 7) { }
1861 1 0 if ($t->op2->op1->term_type == 1 and $t->op2->op1->value == $op1->value) { }
1874 2 3 unless (defined $return_t)
1881 1 175 if ($op1->term_type == 0 and $op1->type == 7) { }
1 174 elsif ($op1->term_type == 1 and $op2->term_type == 0 and $op2->type == 8 and $op2->op1->term_type == 1 and $op2->op1->value == $op1->value) { }
122 52 elsif ($op2->term_type == 1 and $op2->special eq '') { }
24 28 elsif ($op1->term_type == 1 and $op1->special eq '' and $op2->term_type == 0 and $op2->type == 3 and $op2->op1->term_type == 1 and $op2->op1->value == 1 and $op2->op2->term_type == 1 and $op2->op2->value == 2) { }
1893 0 122 if ($val == 0) { }
5 117 elsif ($val == 1) { }
111 6 elsif ($val > 1 and $val eq int $val) { }
0 6 elsif ($val == -1) { }
6 0 elsif ($val < -1) { }
1902 36 75 if ($op1->term_type == 1 and $op1->special eq '') { }
1930 0 0 if ($op1->term_type == 0)
1933 0 0 if (defined $op1_col and not $op1->is_identical($op1_col))
1946 10 14 if ($op1->value < 0) { }
0 14 elsif ($op1->value == 0) { }
1956 14 0 if ($sqrt == int $sqrt) { }
1968 3 25 if ($op1->term_type == 0)
1971 0 28 if (defined $op1_col and not $op1->is_identical($op1_col))
1976 25 3 if ($op2->term_type == 0)
1979 5 23 if (defined $op2_col and not $op2->is_identical($op2_col))
1989 0 0 if (defined $op1_col)
1993 0 0 if $t->type == 6
2007 160 242 if ($t->type == 4) { }
2008 99 61 if ($op1->term_type == 1 and $op1->special eq '') { }
2028 0 12458 unless (defined $return_t)
2039 210 990 if ($tree->term_type == 2) { }
200 790 elsif ($tree->term_type == 1) { }
25 765 elsif ($tree->term_type == 0 and $tree->arity == 1) { }
0 765 elsif ($tree->term_type == 0 and $tree->type == 3) { }
344 421 elsif ($tree->term_type == 0 and $tree->type == 2) { }
418 3 elsif ($tree->term_type == 0 and $tree->type == 0) { }
0 3 elsif ($tree->term_type == 0 and $tree->type == 1) { }
2041 210 0 if ($s eq '+') { }
0 0 elsif ($s eq '-') { }
2051 200 0 if ($s eq '+') { }
0 0 elsif ($s eq '-') { }
2061 25 0 if ($s eq '+') { }
0 0 elsif ($s eq '-') { }
2071 0 0 if ($s eq '+') { }
0 0 elsif ($s eq '-') { }
2085 343 1 if ($ok1 and $ok2)
2086 0 343 if ($s eq "-")
2111 528 414 if ($tree->term_type == 2) { }
274 140 elsif ($tree->term_type == 1) { }
11 129 elsif ($tree->term_type == 0 and $tree->arity == 1) { }
0 129 elsif ($tree->term_type == 0 and $tree->type == 3) { }
1 128 elsif ($tree->term_type == 0 and $tree->type == 7) { }
127 1 elsif ($tree->term_type == 0 and $tree->type == 2) { }
2130 0 0 if ($op1->term_type == 2 and $exp->term_type == 1 and $exp->value eq int $exp->value and $exp->value > 0)
2154 0 784 if ($e->{'type'} eq 'variable' or $e->{'type'} eq 'constant' or $e->{'type'} eq 'function') { }
0 784 elsif ($e->{'type'} eq 'fraction') { }
784 0 elsif ($e->{'type'} eq 'products') { }
2173 989 1411 if ($c->{'type'} eq 'constant' and $c->{'object'}->special eq '') { }
2181 65 719 if (scalar @v_e == 0)
2185 520 199 if ($const != 1)
2191 0 1931 if ($e->{'type'} eq 'fraction') { }
2214 719 0 if (scalar @den_to_mul == 0)
2218 0 0 if (scalar @den_to_mul == 1)
2221 0 0 if ($den->term_type == 1 and $den->value == 1)