Branch Coverage

blib/lib/Chemistry/OpenSMILES.pm
Criterion Covered Total %
branch 144 202 71.2


line true false branch
81 2975 712 unless $atom->{'symbol'} eq "H"
82 1 711 if &any(sub { exists $atom->{$_}; } , "chirality", "isotope")
83 0 711 if $atom->{'charge'}
84 0 711 if $atom->{'class'}
85 12 699 unless $moiety->degree($atom) == 1
88 4 695 if $neighbour->{'symbol'} eq "H"
91 4 691 if (is_cis_trans_bond($moiety, $atom, $neighbour))
95 0 4 if $n_cis_trans == 1
99 63 632 if (&is_chiral($neighbour))
100 0 63 unless &is_chiral_tetrahedral($neighbour)
101 0 63 unless $neighbour->{'chirality_neighbours'}
102 0 63 unless @{$neighbour->{'chirality_neighbours'};} == 4
121 58 7 unless &is_chiral_allenal($atom) or &is_chiral_planar($atom) or &is_chiral_tetrahedral($atom) or &is_chiral_trigonal_bipyramidal($atom)
130 3 4 exists $atom->{'hcount'} ? :
132 0 7 if (&is_chiral_allenal($atom))
138 0 7 if (&is_chiral_trigonal_bipyramidal($atom)) { }
139 0 0 if @neighbours + $hcount != 5
141 0 7 if @neighbours + $hcount != 4
149 0 7 if (&is_chiral_planar($atom)) { }
0 7 elsif (&is_chiral_trigonal_bipyramidal($atom)) { }
151 0 0 if scalar keys %colors > 2
152 0 0 if scalar keys %colors == 2 and &all(sub { $_ == 2; } , values %colors)
154 0 0 if scalar keys %colors == 5
156 2 5 if scalar keys %colors == 4
160 2 3 if (@ring_neighbours)
161 0 2 unless &is_chiral_tetrahedral($atom)
162 2 0 unless @ring_neighbours == 2
163 0 0 if $hcount == 1
164 0 0 unless ($hcount)
165 0 0 if $_ != $ring_neighbours[0]
168 0 0 unless &$color_sub($non_ring_neighbours[0]) eq &$color_sub($non_ring_neighbours[1])
196 7533 5 if (ref $what eq 'HASH') { }
206 677 0 if (ref $what eq 'HASH') { }
216 93 0 if (ref $what eq 'HASH') { }
226 840 5 if (ref $what eq 'HASH') { }
237 112 0 if (ref $what eq 'HASH') { }
247 32 0 if (ref $what eq 'HASH') { }
272 24 34 unless $moiety->degree($atom) > 1
288 56 93 unless $max_length
291 58 91 if &any(sub { $moiety->degree($_) == 1; } , $a, $b)
292 27 64 if $moiety->vertices > $moiety->edges
294 25 39 if ($max_length < 0)
298 330 3 unless $_->[0] == $a and $_->[1] == $b
311 0 753 if @seen != 1
348 25 5 if (ref $what eq 'HASH') { }
349 2 23 if (&is_chiral_tetrahedral($what))
350 1 1 $what->{'chirality'} eq '@' ? :
352 1 24 if (&is_chiral_allenal($what))
353 1 0 $what->{'chirality'} eq '@AL1' ? :
356 0 25 if (&is_chiral_trigonal_bipyramidal($what))
361 0 0 if $Chemistry::OpenSMILES::TB[$_]{'axis'}[0] == $setting->{'axis'}[0] and $Chemistry::OpenSMILES::TB[$_]{'axis'}[1] == $setting->{'axis'}[1]
365 0 25 if (&is_chiral_octahedral($what))
371 0 0 if $Chemistry::OpenSMILES::OH[$_]{'shape'} eq $setting->{'shape'} and $Chemistry::OpenSMILES::OH[$_]{'axis'}[0] == $setting->{'axis'}[0] and $Chemistry::OpenSMILES::OH[$_]{'axis'}[1] == $setting->{'axis'}[1]
384 111 79 unless $_[0] =~ m[^[\\/]$]
385 58 21 $_[0] eq '/' ? :
394 0 0 unless can_unsprout_hydrogen($moiety, $atom)
399 0 0 if (&is_chiral_tetrahedral($neighbour))
403 0 0 unless $pos % 2
416 182 943 exists $bond_symbol_to_order{$_} ? :
418 0 456 $atom->{'hcount'} ? :
206 919 $moiety->has_edge_attribute($atom, $_, 'bond') ? :
437 1 77 if (&is_aromatic($atom) and $moiety->degree($atom) and 2 > grep({is_aromatic_bond($moiety, $atom, $_);} $moiety->neighbours($atom)))
445 6 574 if (&is_chiral_allenal($atom)) { }
8 566 elsif (&is_chiral_tetrahedral($atom)) { }
62 504 elsif (not &is_chiral($atom) and $moiety->degree($atom) == 4) { }
446 0 6 if ($moiety->degree($atom) != 2)
454 0 6 unless ($allenes->has_vertex($atom))
461 5 3 if $allenes->has_edge_attribute($atom, $_, "allene")
1 5 if (&none(sub { $allenes->get_edge_attribute($atom, $_, "allene") eq "mid" if $allenes->has_edge_attribute($atom, $_, "allene"); } , $allenes->neighbours($atom)))
471 2 3 unless $color_sub
472 0 3 if is_ring_atom($moiety, $atom, scalar $moiety->edges)
474 6 2 if $allenes->has_edge_attribute($atom, $_, "allene")
477 18 6 if $_ ne $ends[0]
482 2 1 if (scalar keys %colors != 4)
492 1 7 if ($moiety->degree($atom) < 3)
501 0 7 if ($moiety->degree($atom) > 4)
510 0 7 unless $color_sub
511 4 3 if is_ring_atom($moiety, $atom, scalar $moiety->edges)
516 1 2 if (scalar keys %colors != 4 - $has_lone_pair)
525 120 128 if ($color_sub) { }
529 4 58 if (scalar keys %colors == 4)
539 0 1305 unless &min(map({$_->{'number'};} @$a)) <=> &min(map({$_->{'number'};} @$b))
542 0 571 if ($A eq $B)
549 51 520 if (is_double_bond($moiety, @$bond)) { }
33 487 elsif (is_cis_trans_bond($moiety, @$bond)) { }
556 12 39 if ($cis_trans_A and $cis_trans_B) { }
3 60 elsif (not $allenes->has_edge(@$bond) and $cis_trans_A + $cis_trans_B == 1) { }
561 1 47 if ($bond_types{$_} and @{$bond_types{$_};} > 1)
593 2 31 unless ($bond_types{'='})
605 1 77 if (&is_aromatic($A) and &is_aromatic($B) and not is_aromatic_bond($moiety, $A, $B) and is_ring_bond($moiety, $A, $B))
622 5 4 if @$system % 2
626 4 12 if $allenes->has_edge_attribute(@$_, "allene")
631 1 3 if ($cis_trans_bonds == 1)
637 3 1 if $cis_trans_bonds
639 6 2 if $_ ne $ends[0]
643 0 1 unless @neighbours_at_ends == 4
663 0 0 unless &min(map({$_->{'number'};} @$a)) <=> &min(map({$_->{'number'};} @$b))
687 12 27 if (@d1 == 2 and @d2 and @d1 + @d2 == @$system) { }
688 6 6 if (@d2 % 2)
708 190 83 if ($moiety->has_edge_attribute($atom, $neighbour, 'bond')) { }
713 84 189 if ($atom->{'number'} > $neighbour->{'number'})