Branch Coverage

blib/lib/Game/HexDescribe/Utils.pm
Criterion Covered Total %
branch 103 334 30.8


line true false branch
62 0 0 if /^hex-describe-(.*)-table$/u
76 3 4 if -e $file
91 1 0 if -e $file
131 6237 115926 if ($line =~ /^;([^#\r\n]+)/u) { }
108564 7362 elsif ($key and ($c, $t) = $line =~ /^(\d+),(.*)/u) { }
0 13737 elsif ($line ne '' and not $line =~ /^\s*#/u) { }
133 0 6237 if exists $data->{$key}
139 18 108546 if ($c == 0)
162 0 0 if index($subtable, "|") != -1
163 0 0 if $subtable =~ /$dice_re/u
164 0 0 if $subtable =~ /$math_re/u
165 0 0 if $subtable =~ /^redirect https?:/u
166 0 0 if $subtable =~ /^names for (.*)/u and $$data{"name for $1"}
167 0 0 if $subtable =~ /^(?:capitalize|titlecase|highlightcase|normalize-elvish) (.*)/u and $data->{$1}
168 0 0 if $subtable =~ /^adjacent hex$/u
169 0 0 if $subtable =~ /^same (.*)/u and $data->{$1} || $aliases{$1} || $1 eq 'adjacent hex'
170 0 0 if $subtable =~ /^(?:here|nearby|closest|other|neighbouring|append|later|with|and|save|store) (.+?)( as (.+))?$/u and $data->{$1}
171 0 0 if $subtable =~ /^(.+) as (.+)/u
173 0 0 unless $data->{$subtable}
268 0 1 if ($map and $map->isa("Mojo::Upload"))
272 0 1 if (my($x, $y) = $hex =~ /^(\d\d)(\d\d)\s*empty$/cgu) { }
1 0 elsif (($x, $y) = $hex =~ /^(\d\d)(\d\d)\s+/cgu) { }
353 0 0 unless $map_data->{$coord}
359 0 0 if (same_direction($coord, $line, $line2->{'line'}))
365 0 0 if ($start and $same_dir)
372 0 0 if (not grep({$_ eq $type;} @{$$map_data{$coord};})) { }
0 0 elsif (not grep({$_ eq "$type-merge";} @{$$map_data{$coord};})) { }
387 0 0 if $merged
423 0 0 unless grep {$_ eq "$type-end";} @{$$map_data{$coord};}
425 0 0 unless $map_data->{$coord}
427 0 0 if grep {$_ eq "$type-merge";} @{$$map_data{$coord};}
476 340 13465 if ($i >= $roll)
477 0 340 if ($line->{'unique'})
503 10 0 unless $redirects and not $ENV{'HEX_DESCRIBE_OFFLINE'}
505 0 0 if $face_generator_url
506 0 0 if $text_mapper_url
509 0 0 if (not $res) { }
0 0 elsif ($res->code == 301 or $res->code == 302) { }
564 341 12 $context eq $word ? :
566 340 13 if ($table_data->{$key})
575 0 480 if ($last eq $text)
605 0 499 if $level > 20
606 0 499 if $level > 20
607 3 496 if ($level == 1)
610 0 4 if ($word =~ /^([a-z]+)="(.*)"/u or $word =~ /(.*)-(\d+)$/u) { }
623 39 461 if (my($just_save, $n, $d, $m, $p, $min, $max, $c, $save_as) = $word =~ /$dice_re/u) { }
0 461 elsif (my($save, $expression, $as) = $word =~ /$math_re/u) { }
0 461 elsif ($word =~ /^(\S+)\?\|\|(.*)/u) { }
0 461 elsif ($word =~ /^!(\S+)\|\|(.*)/u) { }
0 461 elsif (index($word, '||') != -1) { }
0 461 elsif (index($word, '|') != -1) { }
7 454 elsif ($word =~ /^name for an? /u) { }
0 454 elsif ($word =~ /^names for (\S+)/u) { }
0 454 elsif ($word =~ /^name for (\S+)/u) { }
0 454 elsif ($word eq 'adjacent hex') { }
0 454 elsif ($word =~ /^(?:nearby|closest|other|later|neighbouring) ./u) { }
0 454 elsif ($word =~ /^append (.*)/u) { }
91 363 elsif ($word =~ /^same (.+)/u) { }
2 361 elsif ($word =~ /^(?:(here|global) )?with (.+?)(?: as (.+))?$/u) { }
2 359 elsif ($word =~ /^(?:(here|global) )?and (.+?)(?: as (.+))?$/u) { }
0 359 elsif ($word =~ /^capitalize (.+)/u) { }
0 359 elsif ($word =~ /^titlecase (.+)/u) { }
0 359 elsif ($word =~ /^highlightcase (.+)/u) { }
1 358 elsif ($word =~ /^normalize-elvish (.+)/u) { }
358 0 elsif ($word =~ /^(?:(here|global) )?(?:(save|store|quote) )?(.+?)(?: as (.+))?$/u) { }
0 0 elsif ($level > 1 and not exists $table_data->{$word} and not $locals{$word}) { }
0 0 elsif ($level > 1 and not $table_data->{$word} and not $locals{$word}) { }
625 0 39 if ($c) { }
633 0 39 if defined $min and $r < $min
634 0 39 if defined $max and $r > $max
637 10 29 if $save_as
638 39 0 unless $just_save
641 0 0 if $as
642 0 0 unless $save
645 0 0 if $locals{$1}
648 0 0 unless $locals{$1}
654 0 0 if ($copy =~ /\S/u)
666 1 6 if $name
668 0 6 unless $name
675 0 0 if (my(@lines) = grep({$_->{'type'} eq $key;} @{$$extra{$coordinates};}))
681 0 0 unless ($name)
688 0 0 if (@names > 2) { }
0 0 elsif (@names == 2) { }
696 0 0 unless $list
697 0 0 unless $list
703 0 0 if (my(@lines) = grep({$_->{'type'} eq $key;} @{$$extra{$coordinates};})) { }
710 0 0 if $name
713 0 0 unless $name
724 0 0 if $name
727 0 0 unless $name
730 0 0 if %$map_data
734 0 0 $coordinates eq 'no map' ? :
743 0 0 unless $text
748 0 91 if exists $locals{$key} and ref $locals{$key} eq "ARRAY"
749 91 0 if exists $locals{$key}
750 0 0 if $globals->{$key} and $globals->{$key}{'global'}
756 0 2 unless $text
758 0 2 if $alias
759 0 2 if $where and $where eq "here"
760 0 0 if $where and $where eq "here" and $alias
761 0 2 if $where and $where eq "global"
762 0 0 if $where and $where eq "global" and $alias
771 0 4 if ref $locals{$key} ne "ARRAY"
772 0 4 if ref $locals{$key} ne "ARRAY"
773 2 2 if not $text or grep {$text eq $_;} @{$locals{$key};}
776 0 2 if $alias
777 0 2 if $where and $where eq "here"
778 0 0 if $where and $where eq "here" and $alias
779 0 2 if $where and $where eq "global"
780 0 0 if $where and $where eq "global" and $alias
784 0 2 unless ($found)
791 0 0 unless $text
797 0 0 unless $text
803 0 0 unless $text
809 0 1 unless $text
815 329 29 if (not $action or $action eq 'save') { }
822 83 275 unless $text
824 33 242 if $alias
825 1 274 if $where and $where eq "here"
826 1 6 if $where and $where eq "here" and $alias
827 6 269 if $where and $where eq "global"
828 6 1 if $where and $where eq "global" and $alias
829 243 32 if not $action or $action eq "quote"
842 0 0 unless defined $text
922 10 9 if ($images) { }
972 0 0 unless closest($map_data, $table_data, $coord, $2, $1, $redirects)
993 0 0 if $type eq "nearby"
994 0 0 unless (@coordinates)
998 0 0 if (not $coordinates =~ /^\d+$/u) { }
1021 0 0 if (@_ == 2)
1028 0 0 if ($x1 > $x2)
1035 0 0 if ($y2 >= $y1) { }
1040 0 0 $x2 - $x1 > $y1 - $y2 ? :
1059 0 0 unless some_other($map_data, $table_data, $coord, $1, $redirects)
1078 0 0 unless (@coordinates)
1102 0 0 unless neighbouring($map_data, $table_data, $coord, $1, $2, $3)
1129 0 0 if (@coordinates) { }
1130 0 0 if $then
1136 0 0 if $else
1165 0 0 if $ref
1168 0 0 unless describe($map_data, $table_data, 1, $coord, [$key], $redirects) . $ref
1169 0 0 unless ($result)
1198 2 0 if $description
1207 1 0 if $description
1243 0 0 unless $line->{'type'} eq $type
1246 0 0 unless grep /$hex/u, @line
1291 0 0 unless ref $hex
1311 0 0 unless ref $hex
1315 0 0 if $map_data->{$neighbour}
1317 0 0 unless @neighbours
1330 0 0 if @arr == 1 and ref $arr[0] eq "ARRAY"
1351 0 0 if (not defined $min or $d < $min)
1374 0 0 if $from->[0] == $points[0][0] and $from->[1] == $points[0][1]
1395 0 0 if ($line1->[$i] eq $coord)
1402 0 0 if $i1 == 0 or $i1 > $line1->$#*
1405 0 0 if ($line2->[$i2] eq $coord)
1406 0 0 if ($$line2[$i2 - 1] and $next eq $$line2[$i2 - 1] or $$line2[$i2 + 1] and $next eq $$line2[$i2 + 1])
1437 0 0 if $seen{$coord} or not $map_data->{$coord}
1439 0 0 if (&intersect(\@keys, \@{$$map_data{$coord};}))
1441 0 0 if $names{"$word for $coord"}
1492 0 128 if (/^$/u) { }
0 128 elsif (/^$/u) { }
0 128 elsif (/^
  • $/u) { }
  • 0 128 elsif (m[^$]u) { }
    0 128 elsif (m[^$]u) { }
    1497 0 0 @list > 1 ? :
    1501 0 0 unless $str =~ /\n$/u