Branch Coverage

blib/lib/Chemistry/OpenSMILES.pm
Criterion Covered Total %
branch 154 214 71.9


line true false branch
93 2975 712 unless $atom->{'symbol'} eq "H"
94 1 711 if &any(sub { exists $atom->{$_}; } , "chirality", "isotope")
95 0 711 if $atom->{'charge'}
96 0 711 if $atom->{'class'}
97 12 699 unless $moiety->degree($atom) == 1
100 4 695 if $neighbour->{'symbol'} eq "H"
103 4 691 if (is_cis_trans_bond($moiety, $atom, $neighbour))
107 0 4 if $n_cis_trans == 1
111 63 632 if (&is_chiral($neighbour))
112 0 63 unless &is_chiral_tetrahedral($neighbour)
113 0 63 unless $neighbour->{'chirality_neighbours'}
114 0 63 unless @{$neighbour->{'chirality_neighbours'};} == 4
133 58 7 unless &is_chiral_allenal($atom) or &is_chiral_planar($atom) or &is_chiral_tetrahedral($atom) or &is_chiral_trigonal_bipyramidal($atom)
142 3 4 exists $atom->{'hcount'} ? :
144 0 7 if (&is_chiral_allenal($atom))
150 0 7 if (&is_chiral_trigonal_bipyramidal($atom)) { }
151 0 0 if @neighbours + $hcount != 5
153 0 7 if @neighbours + $hcount != 4
161 0 7 if (&is_chiral_planar($atom)) { }
0 7 elsif (&is_chiral_trigonal_bipyramidal($atom)) { }
163 0 0 if scalar keys %colors > 2
164 0 0 if scalar keys %colors == 2 and &all(sub { $_ == 2; } , values %colors)
166 0 0 if scalar keys %colors == 5
168 2 5 if scalar keys %colors == 4
172 2 3 if (@ring_neighbours)
173 0 2 unless &is_chiral_tetrahedral($atom)
174 2 0 unless @ring_neighbours == 2
175 0 0 if $hcount == 1
176 0 0 unless ($hcount)
177 0 0 if $_ != $ring_neighbours[0]
180 0 0 unless &$color_sub($non_ring_neighbours[0]) eq &$color_sub($non_ring_neighbours[1])
208 7650 5 if (ref $what eq 'HASH') { }
218 698 0 if (ref $what eq 'HASH') { }
228 93 0 if (ref $what eq 'HASH') { }
238 861 5 if (ref $what eq 'HASH') { }
249 112 0 if (ref $what eq 'HASH') { }
259 32 0 if (ref $what eq 'HASH') { }
284 24 34 unless $moiety->degree($atom) > 1
300 58 94 unless $max_length
303 56 96 if &any(sub { $moiety->degree($_) == 1; } , $a, $b)
304 27 69 if $moiety->vertices > $moiety->edges
306 27 42 if ($max_length < 0)
310 324 5 unless $_->[0] == $a and $_->[1] == $b
323 0 811 if @seen != 1
360 25 5 if (ref $what eq 'HASH') { }
361 2 23 if (&is_chiral_tetrahedral($what))
362 1 1 $what->{'chirality'} eq '@' ? :
364 1 24 if (&is_chiral_allenal($what))
365 1 0 $what->{'chirality'} eq '@AL1' ? :
368 0 25 if (&is_chiral_trigonal_bipyramidal($what))
373 0 0 if $Chemistry::OpenSMILES::TB[$_]{'axis'}[0] == $setting->{'axis'}[0] and $Chemistry::OpenSMILES::TB[$_]{'axis'}[1] == $setting->{'axis'}[1]
377 0 25 if (&is_chiral_octahedral($what))
383 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]
397 2 5 if @$A <=> @$B
400 0 5 unless $A->[$_]{'number'} <=> $B->[$_]{'number'}
410 8 0 unless defined $max_length
413 6 2 if ($atom) { }
424 55 15 unless $rings_by_name{$name}
435 111 79 unless $_[0] =~ m[^[\\/]$]
436 58 21 $_[0] eq '/' ? :
445 0 0 unless can_unsprout_hydrogen($moiety, $atom)
450 0 0 if (&is_chiral_tetrahedral($neighbour))
454 0 0 unless $pos % 2
467 182 943 exists $bond_symbol_to_order{$_} ? :
469 0 456 $atom->{'hcount'} ? :
206 919 $moiety->has_edge_attribute($atom, $_, 'bond') ? :
488 1 89 if (&is_aromatic($atom) and $moiety->degree($atom) and 2 > grep({is_aromatic_bond($moiety, $atom, $_);} $moiety->neighbours($atom)))
496 6 595 if (&is_chiral_allenal($atom)) { }
8 587 elsif (&is_chiral_tetrahedral($atom)) { }
62 525 elsif (not &is_chiral($atom) and $moiety->degree($atom) == 4) { }
497 0 6 if ($moiety->degree($atom) != 2)
505 0 6 unless ($allenes->has_vertex($atom))
512 5 4 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)))
522 2 3 unless $color_sub
523 0 3 if is_ring_atom($moiety, $atom, scalar $moiety->edges)
525 6 2 if $allenes->has_edge_attribute($atom, $_, "allene")
528 18 6 if $_ ne $ends[0]
533 2 1 if (scalar keys %colors != 4)
543 1 7 if ($moiety->degree($atom) < 3)
552 0 7 if ($moiety->degree($atom) > 4)
561 0 7 unless $color_sub
562 4 3 if is_ring_atom($moiety, $atom, scalar $moiety->edges)
567 1 2 if (scalar keys %colors != 4 - $has_lone_pair)
576 120 128 if ($color_sub) { }
580 4 58 if (scalar keys %colors == 4)
590 0 1361 unless &min(map({$_->{'number'};} @$a)) <=> &min(map({$_->{'number'};} @$b))
593 0 594 if ($A eq $B)
600 51 543 if (is_double_bond($moiety, @$bond)) { }
33 510 elsif (is_cis_trans_bond($moiety, @$bond)) { }
607 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) { }
612 1 47 if ($bond_types{$_} and @{$bond_types{$_};} > 1)
644 2 31 unless ($bond_types{'='})
656 2 89 if (&is_aromatic($A) and &is_aromatic($B) and not is_aromatic_bond($moiety, $A, $B) and is_ring_bond($moiety, $A, $B))
666 1 1 unless can_be_aromatic_ring(@$_)
682 5 4 if @$system % 2
686 4 12 if $allenes->has_edge_attribute(@$_, "allene")
691 1 3 if ($cis_trans_bonds == 1)
697 3 1 if $cis_trans_bonds
699 6 2 if $_ ne $ends[0]
703 0 1 unless @neighbours_at_ends == 4
723 0 0 unless &min(map({$_->{'number'};} @$a)) <=> &min(map({$_->{'number'};} @$b))
747 12 27 if (@d1 == 2 and @d2 and @d1 + @d2 == @$system) { }
748 6 6 if (@d2 % 2)
768 190 83 if ($moiety->has_edge_attribute($atom, $neighbour, 'bond')) { }
773 84 189 if ($atom->{'number'} > $neighbour->{'number'})