Branch Coverage

blib/lib/Games/SGF.pm
Criterion Covered Total %
branch 342 474 72.1


line true false branch
248 3 8 exists $opts{'Fatal'} ? :
249 11 0 exists $opts{'Warn'} ? :
250 11 0 exists $opts{'Debug'} ? :
286 0 8 if ($self->Fatal) { }
311 0 0 unless (open $fh, '<', $filename)
315 0 0 if (read($fh, $text, -s $filename) == 0)
340 0 2 if ($self->Fatal)
364 0 0 unless (open $fh, '>', $filename)
370 0 0 if ($self->Fatal)
404 0 21 unless ($tagname =~ /^[a-zA-Z]+$/)
410 4 17 if (exists $$self{'tags'}{$tagname} or exists $ff4_properties{$tagname})
443 0 39 unless defined $_
449 0 11 unless ($tagname =~ /^[a-zA-Z]+$/)
458 7 4 if (exists $ff4_properties{$tagname}) { }
3 1 elsif (exists $$self{'tags'}{$tagname}) { }
459 7 0 defined $type ? :
460 6 1 defined $value ? :
461 6 1 defined $value_flags ? :
462 0 7 defined $attrib ? :
466 2 1 if defined $type
467 2 1 if defined $value
468 2 1 if defined $value_flags
469 2 1 if defined $attrib
490 3 5 if (exists $$self{'pointRead'})
494 4 1 if (ref $coderef eq 'CODE') { }
511 3 5 if (exists $$self{'moveRead'})
515 4 1 if (ref $coderef eq 'CODE') { }
554 3 2 if (exists $$self{'stoneRead'})
558 1 1 if (ref $coderef eq 'CODE') { }
577 0 5 if (exists $$self{'pointCheck'})
581 4 1 if (ref $coderef eq 'CODE') { }
598 0 5 if (exists $$self{'moveCheck'})
602 4 1 if (ref $coderef eq 'CODE') { }
642 0 2 if (exists $$self{'stoneCheck'})
646 1 1 if (ref $coderef eq 'CODE') { }
664 0 5 if (exists $$self{'pointWrite'})
668 4 1 if (ref $coderef eq 'CODE') { }
685 0 5 if (exists $$self{'moveWrite'})
689 4 1 if (ref $coderef eq 'CODE') { }
724 0 2 if (exists $$self{'stoneWrite'})
728 1 1 if (ref $coderef eq 'CODE') { }
751 84 891 if (exists $$self{'tags'}{$tag}) { }
891 0 elsif (exists $ff4_properties{$tag}) { }
752 30 54 if ($$self{'tags'}{$tag}{'value_flags'}) { }
758 103 788 if ($ff4_properties{$tag}{'value_flags'}) { }
783 41 366 if (exists $$self{'tags'}{$tag}) { }
366 0 elsif (exists $ff4_properties{$tag}) { }
784 26 15 if ($$self{'tags'}{$tag}{'type'})
788 366 0 if ($ff4_properties{$tag}{'type'})
811 27 349 if (exists $$self{'tags'}{$tag}) { }
349 0 elsif (exists $ff4_properties{$tag}) { }
812 3 24 if ($$self{'tags'}{$tag}{'attrib'})
816 21 328 if ($ff4_properties{$tag}{'attrib'})
838 181 1974 if (exists $$self{'tags'}{$tag}) { }
1974 0 elsif (exists $ff4_properties{$tag}) { }
839 181 0 if ($$self{'tags'}{$tag}{'value'})
843 1974 0 if ($ff4_properties{$tag}{'value'})
868 0 0 if ($curGame >= $lastGame) { }
893 0 0 if ($curGame <= 0) { }
916 6 0 if (defined $game) { }
917 0 6 unless ($game >= 0 and $game < @{$$self{'collection'};})
980 13 0 if ($$self{'node'}{'parent'}) { }
1023 0 119 unless (defined $n)
1024 112 7 if ($n < $self->branches and $n >= 0) { }
7 0 elsif ($n == 0) { }
1129 0 8 if ($self->Fatal) { }
1176 0 1 if (@{$$self{'node'}{'branches'};}) { }
1187 1 1 if ($rem == $$self{'node'}{'branches'}[$i])
1222 5 134 if (not defined $tag) { }
133 1 elsif (@values == 0) { }
1261 11 237 if ($attri == 2 and not $isStrict) { }
1264 10 9 if (exists $$node{'tags'}{$tag}) { }
8 1 elsif ($$node{'parent'}) { }
1274 115 122 if (exists $$self{'node'}{'tags'}{$tag}) { }
1320 5 123 scalar @values == 0 ? :
1329 5 123 if ($isUnSet)
1330 5 0 if (exists $$self{'node'}{'tags'}{$tag}) { }
1343 0 123 if (@values > 1 and not $flags & 4)
1350 0 123 if ($ttype == 4 and 0 != $$self{'node'}{'parent'})
1359 29 243 if ($tnode) { }
48 195 elsif ($tag_type == 1 or $tag_type == 2) { }
1360 0 29 if ($tnode == 2 and $tag_type == 1 or $tnode == 1 and $tag_type == 2)
1370 123 0 unless ($isUnSet)
1373 0 134 if ($self->isComposed($_) and not $isComposable)
1377 0 134 unless ($self->_tagCheck($tag, 0, $_))
1408 10 17 if ($self->isComposed($cop1)) { }
1506 1 7 if ($self->isPoint($_[0])) { }
1515 1 5 if ($self->isStone($_[0])) { }
1524 1 31 if ($self->isMove($_[0])) { }
1589 54 23 unless (@_)
1595 0 23 if (ref $$self{'Fatal'} eq 'CODE') { }
0 23 elsif ($$self{'Fatal'}) { }
1604 0 130 unless (@_)
1610 0 130 if (ref $$self{'Warn'} eq 'CODE') { }
0 130 elsif ($$self{'Warn'}) { }
1619 0 1869 unless (@_)
1625 0 1869 if (ref $$self{'Debug'} eq 'CODE') { }
0 1869 elsif ($$self{'Debug'}) { }
1669 1227 299 if ($package =~ /^Games::SGF/) { }
1686 8 131 if (@values > 1)
1692 6 125 if (ref $type eq 'ARRAY')
1693 3 3 $isSecond ? :
1697 6 125 if ($values[0] eq '')
1698 2 4 if ($type == 1) { }
0 4 elsif ($self->getTagFlags($tag) & 2) { }
0 4 elsif (not $type == 8 || $type == 9 || $type == 10) { }
1718 0 172 if ($type == 5) { }
0 172 elsif ($type == 4) { }
28 144 elsif ($type == 2) { }
18 126 elsif ($type == 3) { }
7 119 elsif ($type == 7) { }
17 102 elsif ($type == 6) { }
0 102 elsif ($type == 1) { }
27 75 elsif ($type == 8) { }
9 66 elsif ($type == 10) { }
66 0 elsif ($type == 9) { }
1719 0 0 if ($text eq 'B') { }
0 0 elsif ($text eq 'W') { }
1728 0 0 if ($text eq '1') { }
0 0 elsif ($text eq '2') { }
1737 28 0 if ($text =~ /^[+-]?[0-9]+$/) { }
1744 18 0 if ($text =~ /^[+-]?[0-9]+(\.[0-9]+)?$/) { }
1757 0 0 if ($text) { }
1765 17 10 if ($$self{'pointRead'}) { }
1771 2 7 if ($$self{'stoneRead'}) { }
1777 20 46 if ($$self{'moveRead'}) { }
1799 8 142 if ($self->isComposed($struct))
1807 6 136 if (ref $type eq 'ARRAY')
1808 3 3 $isSecond ? :
1811 2 140 if ($self->isEmpty($struct))
1812 2 0 if ($type == 1) { }
0 0 elsif ($self->getTagFlags($tag) & 2) { }
0 0 elsif (not $type == 8 || $type == 9 || $type == 10) { }
1832 0 140 if ($type == 5) { }
0 140 elsif ($type == 4) { }
29 111 elsif ($type == 2) { }
18 93 elsif ($type == 3) { }
14 79 elsif ($type == 7) { }
17 62 elsif ($type == 6) { }
0 62 elsif ($type == 1) { }
22 40 elsif ($type == 8) { }
4 36 elsif ($type == 10) { }
36 0 elsif ($type == 9) { }
1833 0 0 if ($struct == 1 or $struct == 2) { }
1839 0 0 if ($struct == 1 or $struct == 2) { }
1845 29 0 if ($struct =~ /^[+-]?[0-9]+$/) { }
1851 18 0 if ($struct =~ /^[+-]?[0-9]+(\.[0-9]+)?$/) { }
1863 0 0 if ($struct) { }
1869 19 3 if ($$self{'pointCheck'})
1873 2 2 if ($$self{'stoneCheck'})
1877 20 16 if ($$self{'moveCheck'})
1895 2 50 if ($self->isComposed($struct))
1903 2 48 if (ref $type eq 'ARRAY')
1904 1 1 $isSecond ? :
1907 1 0 if ($self->isEmpty($struct) and $self->getTagFlags($tag) & 2 || $type == 1)
1920 0 52 if ($type == 5) { }
0 52 elsif ($type == 4) { }
14 38 elsif ($type == 2) { }
8 30 elsif ($type == 3) { }
1 29 elsif ($type == 7) { }
7 22 elsif ($type == 6) { }
0 22 elsif ($type == 1) { }
7 15 elsif ($type == 8) { }
1 14 elsif ($type == 10) { }
14 0 elsif ($type == 9) { }
1921 0 0 if ($struct == 1) { }
0 0 elsif ($struct == 2) { }
1930 0 0 if ($struct == 1) { }
0 0 elsif ($struct == 2) { }
1951 6 1 if ($$self{'pointWrite'}) { }
1957 0 1 if ($$self{'stoneWrite'}) { }
1963 9 5 if ($$self{'moveWrite'}) { }
1979 181 739 if (ref $self->getTagValueType($prop) eq 'ARRAY' or $self->getTagFlags($prop) & 8) { }
1991 80 274 if ($self->_maybeComposed($prop)) { }
82 192 elsif ($type == 6) { }
1992 36 44 if (ref $type eq 'ARRAY') { }
0 44 elsif ($type == 6) { }
1993 36 0 if ($$type[$part] == 6)
2012 80 350 if ($self->_maybeComposed($prop)) { }
76 274 elsif ($type == 7) { }
2013 36 44 if (ref $type eq 'ARRAY') { }
0 44 elsif ($type == 7) { }
2014 0 36 if ($$type[$part] == 7)
2059 561 467 if ($inValue) { }
14 453 elsif ($char eq '(') { }
14 439 elsif ($char eq ')') { }
46 393 elsif ($char eq ';') { }
123 270 elsif ($char eq '[') { }
84 186 elsif ($char =~ /\s/) { }
186 0 elsif ($char =~ /[a-zA-Z]/) { }
2060 123 438 if ($char eq ']' and not $isEscape) { }
8 430 elsif ($char eq ':' and $self->_maybeComposed($propertyName)) { }
76 354 elsif ($self->_isText($propertyName, $propI)) { }
118 236 elsif ($self->_isSimpleText($propertyName, $propI)) { }
2062 0 123 unless ($inValue)
2069 123 0 if (defined $val) { }
2081 0 8 if ($propI >= 1)
2089 3 73 if ($isEscape) { }
3 70 elsif ($char eq '\\') { }
1 69 elsif ($char =~ /\n/) { }
6 63 elsif ($char =~ /\s/) { }
2090 1 2 if ($char eq "\n") { }
1 1 elsif ($char =~ /\s/) { }
2106 2 116 if ($isEscape) { }
2 114 elsif ($char eq '\\') { }
2 112 elsif ($char =~ /\n/) { }
8 104 elsif ($char =~ /\s/) { }
2107 1 1 if ($char eq "\n") { }
0 1 elsif ($char =~ /\s/) { }
2125 3 11 if (@values)
2129 0 3 if $old
2130 0 3 unless $self->setProperty($lastName, @values)
2133 6 8 if ($inTree) { }
2136 0 6 unless ($self->addNode)
2142 0 8 unless ($self->addGame)
2148 11 3 if (@values)
2150 0 11 if $old
2151 0 11 unless $self->setProperty($lastName, @values)
2154 8 6 if (not @variations) { }
2162 32 14 if (@values)
2165 0 32 if $old
2166 0 32 unless $self->setProperty($lastName, @values)
2170 0 46 unless ($inTree)
2175 14 32 if ($isStart) { }
0 32 elsif (not $self->addNode) { }
2186 9 114 unless ($propertyName)
2194 0 84 if $propertyName
2197 68 118 if (@values)
2200 1 67 if $old
2201 0 68 unless $self->setProperty($lastName, @values)
2204 0 186 if ($isFinal)
2225 0 45 if (@values == 0) { }
2233 0 48 unless defined $val
2247 0 4 unless $node
2261 15 0 if ($node) { }
2267 0 15 if (not $$node{'branches'}) { }
11 4 elsif (@{$$node{'branches'};} == 1) { }