Branch Coverage

blib/lib/Chemistry/Harmonia.pm
Criterion Covered Total %
branch 283 324 87.3


line true false branch
96 5201 181 unless $substance =~ /$_/i
98 78 103 if (length $_ > 1) { }
137 3 5 if (/^@maUl\d+$/i and @maU and /^(?i:[@maU])\L[@maU]\d+$\E/)
140 1 2 if (/$mz/ and exists $$opts{'zero2oxi'})
149 4 39 if (/\*/)
153 1 7 if ($i =~ /^(\d+)[a-zA-Z]/) { }
2 5 elsif ($i =~ /^(\d*\.(\d+))/) { }
158 1 1 if length $2 >= length $l
165 1 3 if ($l > 1)
171 1 3 if ($gcd > 1)
177 2 6 $k{$1} > 1 ? :
189 67 60 if ($s =~ /[$sas]/i) { }
4 56 elsif ($s =~ /\$/) { }
4 52 elsif ($s =~ /$mz/ and exists $$opts{'zero2oxi'}) { }
208 43 0 $$cf[0] =~ /\w/ ? :
227 9167 16603 if (length $s == 1)
228 12 9155 unless @i_maU
235 38 16565 unless my(@i_maUl) = grep(($s =~ /$_/i), @$maUl) or @i_maU
245 31571 2834 if $saUl =~ /$_/i
255 40803 5910 if $m =~ /$_/i or $saU =~ /$_/i
265 9367 7198 if (length $_ == 2)
271 4561 4806 if (/$saUl/ or /[$saU]{2}/) { }
0 4806 elsif (/\U$saUl\E/) { }
1 4805 elsif (@i_maU and /[$saU][\L$saU\E]/ || /[\L$saU\E][$saU]/) { }
0 4805 elsif (/$salU/) { }
1 4804 elsif (length $saUl == 0) { }
290 4804 0 if (/[\L$saU]{2}\E/)
293 4804 0 if (/\L$saUl\E/)
297 0 4804 unless @in_cf
299 4804 0 if (@in_cf == 2)
326 2218 4980 if (length $z)
329 480 1738 if length $z == length $_
332 969 769 if 3 > length $_
336 1802 3947 if (@w)
343 2058 868 if ($#{$cf;})
346 0 8072 if length $$cf[$i] < length $$cf[0]
363 12 21796 unless &_in_gf($_, \@i_maU, \@i_maUl, $cf_new)
367 23063 24548 unless scalar grep((length $_ > length $k || $_ eq $k), @$cf)
401 0 66 unless $ce
409 358 0 exists $$coef{$s} ? :
443 0 829 if @$ce != 2 or scalar grep((!defined($_)), @$ce) or scalar grep({grep((!defined($_)), @{$_;});} @$ce)
447 49 780 if (exists $$opts{'norma'} and scalar grep({grep((!exists($$opts{'coefficients'}{$_})), @{$_;});} @$ce) == 0)
455 6 49 unless $$opts{'coefficients'}{$_}
456 24 25 if $$opts{'coefficients'}{$_} < 0
461 49 780 if ($sign != 0) { }
464 0 49 if ($$opts{'norma'} != 1)
470 23 234 unless $c
471 107 127 $sign * $c > 0 ? :
482 779 1 if (exists $$opts{'substances'} and @{$$opts{'substances'};}) { }
488 2928 2714 if (exists $bs{$_}) { }
489 3 2925 exists $$opts{'coefficients'}{$_} ? :
496 3 3 exists $$opts{'coefficients'}{$_} ? :
502 829 0 /\S\s*[=+]+\s*\S/ ? :
512 2 14 unless exists $$opts{'redox_pairs'}
518 16 0 @cheq ? :
529 0 1389 if @$chem_eq != 2
542 2 0 unless exists $$opts{'coefficients'}{$s}
546 597 75 if (exists $$opts{'coefficients'} and keys %{$$opts{'coefficients'};})
553 2875 1301 if (exists $$opts{'coefficients'}{$s})
579 590 1274 unless ($sum_atom[$i])
580 538 52 if $$R_free[$i]
584 1243 83 if $$R_free[$i]
597 0 59 unless ($num_atoms -= @atom_del)
606 0 59 if ((my(@v) = values %$atoms_substance) == 1)
610 0 0 if $v[0][$i] * $$R_free[$i + 1] != $v[0][$i + 1] * $$R_free[$i]
618 0 134 if @$substances_X < 2 and $R_zero
629 17 117 if $R_zero and $order == @$substances_X
631 12 105 if (@$substances_X - $order > 1)
634 6 6 if @$cheq
636 2 4 if ($$opts{'redox_pairs'} and my $redox = &redox_test($chem_eq))
657 2 10 unless @$pair_oxi
663 16 16 if exists $$redox{$nm_rx[0]}{$e}{$i_k}
671 0 34 if $sum_oxi_e < @{$pair_red;}
677 31 0 if exists $$redox{$nm_rx[1]}{$e}{$i_k}
681 11 23 if $sum_red_e < @{$pair_oxi;}
693 1076 122 if $sum_e != $sum_red_e
703 4609 595 if $sum_e != $sum_oxi_e
714 3110 0 unless (exists $$opts{'coefficients'}{$_})
724 2268 0 unless (exists $$opts{'coefficients'}{$_})
744 48 778 if @$ys < 2
757 46 59 if ($R_zero or $R_zero == 0 and @$substances_X == $order + 1)
762 46 4 if Rank([map($$atoms_substance{$_}, @$base_subst)]) == $order
775 82 23 if ($ao > 0)
791 82 6 if Rank([map($$atoms_substance{$_}, @$base_subst)]) == $order
803 0 105 unless my $steX = Solve_Det([map($$atoms_substance{$_}, @$base_subst)], $R_free, {'eqs', 'column', 'int', 1})
823 46 59 if defined $var_subst
825 59 46 unless ($R_zero)
837 82 23 if ($ao > 0)
846 56 26 if scalar grep($_, @balance)
850 0 49 if ((my $gcd = bgcd(values %cfs)) > 1)
857 32 17 unless scalar grep(($_ eq $keq), @$cheq)
903 0 67 if ($n > 1) { }
905 0 0 if ($gcd > 1)
925 12 11 unless exists $rx[1]{$e}{$_}
929 0 10 unless exists $rx[0]{$e}{$_}
936 0 4 unless keys %{$rx[0];} and keys %{$rx[1];}
957 8 10 if ($n_os_i > $n_os_p) { }
7 3 elsif ($n_os_i < $n_os_p) { }
969 1 17 if exists $del_rx{$v_i}
975 2 21 if exists $del_rx{$v_p}
1005 6 5 if keys %{$redox{$nm}{$e};} < 2
1009 13 6 if $ve{$_} < 3
1010 4 2 if $vv{$_}{'yes'} > 1
1011 0 2 if keys %{$vv{$_}{'os'};} > 1
1022 2 2 keys %{$redox{'oxidant'};} && keys %{$redox{'reducer'};} ? :
1036 0 7213 unless my(%f) = eval { do { 'Chemistry::File::Formula'->parse_formula($s) } }
1047 717 4075 if $v == 1
1053 12005 11104 unless $tmp_subs{$subs}{$_}
1063 0 3 unless my(%e) = eval { do { 'Chemistry::File::Formula'->parse_formula($s) } }
1095 1245 253 /(.+?)\s*[=-]+>*\s*(.+)/ ? :
1099 0 1498 unless @$chem_eq
1108 39 8077 if (/^(\d+)([({\[a-zA-Z].*)/) { }
6 8071 elsif (s/^0(.)/O$1/) { }
12 8059 elsif (/^0$/) { }
411 7648 elsif (/^\d+$/) { }
1113 2 37 if ($c =~ /^0$/ and $i == 0 || $i > 0 && $$ip[$i - 1] =~ /\D/) { }
2 35 elsif (s/^0/O/) { }
1128 5 7 if ($i < $#{$ip;} and not exists $$coef{'zero2oxi'}) { }
1139 402 9 if (defined $$ip[$i + 1]) { }
5 4 elsif ($ip eq $$chem_eq[0] and @{$$chem_eq[1];} == 1 and $$chem_eq[1][0] =~ /[a-zA-Z]/) { }
1163 10 8433 if ($$ip[$i] eq $$ip[$j])
1173 3 1495 unless (@{$$chem_eq[0];})
1174 1 2 if @{$$chem_eq[1];} < 2
1182 2 10377 if $s eq $$chem_eq[1][$i]
1188 6 1491 unless (@{$$chem_eq[1];})
1189 2 4 if @{$$chem_eq[0];} < 2
1206 8 7 if (exists $$cf{$$ip[$i]})
1223 198 1 if @species < 2 or $s ne join('', @species)
1243 2 2 if ($d)
1258 0 200 unless keys %nf
1271 0 200 if keys %$atom_el_neg != keys %nf
1276 2 198 if ($intermet or keys %nf == 1)
1301 198 358 if ($i < $#neg and $$atom_el_neg{$neg[0]} == $$atom_el_neg{$neg[$i + 1]} or $i == 1) { }
198 160 elsif ($i == 0) { }
1316 5 551 if $e =~ /He|Ne|Ar|Kr|Xe|Rn/
1319 383 173 length $e == 1 ? :
1324 526 60 if ($num{$e} == 1) { }
1332 60 60 if $count++ == $j
1354 391 175 length $e == 1 ? :
1363 598 64 if $count++ == $j
1365 586 12 if ($yni)
1370 22 321 unless /$mg/
1376 298 23 if (@{$$ions{$e}{$l}{$mg};} == 1) { }
1397 17 6 if $n_OS > $max_n_OS
1406 126 151 if $n_OS > $max_n_OS
1408 144 133 if ($n_OS) { }
1427 106 95 if ($max_n_OS)
1440 135 906 if (exists $osin{$x}) { }
1449 78 963 unless defined $sum
1456 104 285 unless $balance_A + $balance_B
1460 0 201 if $no_ion and $balance_A + $balance_B
1477 3 198 if ($balance_A) { }
1478 0 3 if $no_ion
1506 22842 558 unless exists $$atoms{$_}
1509 415 143 unless $$adb[$i + 3]
1534 5800 15600 if ($os =~ /~/) { }
1541 5800 6600 if ($e =~ /(\w+~)(.*)/)
1546 5400 400 if $n_ek > $max_n_ek
1557 0 27800 unless defined $e
1562 27743 57 unless $chem_sub =~ /($m)/
1577 57 67 if $e =~ /~/
1587 15484 116 unless $chem_sub =~ /($frm)/