Branch Coverage

blib/lib/Game/HexDescribe/Utils.pm
Criterion Covered Total %
branch 72 326 22.0


line true false branch
62 0 0 if /^hex-describe-(.*)-table$/u
76 2 0 if -e $file
90 1 0 if -e $file
130 4134 76820 if ($line =~ /^;([^#\r\n]+)/u) { }
71936 4884 elsif ($key and ($c, $t) = $line =~ /^(\d+),(.*)/u) { }
0 9110 elsif ($line ne '' and not $line =~ /^\s*#/u) { }
132 0 4134 if exists $data->{$key}
138 12 71924 if ($c == 0)
161 0 0 if index($subtable, "|") != -1
162 0 0 if $subtable =~ /$dice_re/u
163 0 0 if $subtable =~ /$math_re/u
164 0 0 if $subtable =~ /^redirect https?:/u
165 0 0 if $subtable =~ /^names for (.*)/u and $$data{"name for $1"}
166 0 0 if $subtable =~ /^(?:capitalize|titlecase|highlightcase|normalize-elvish) (.*)/u and $data->{$1}
167 0 0 if $subtable =~ /^adjacent hex$/u
168 0 0 if $subtable =~ /^same (.*)/u and $data->{$1} || $aliases{$1} || $1 eq 'adjacent hex'
169 0 0 if $subtable =~ /^(?:here|nearby|other|append|later|with|and|save|store) (.+?)( as (.+))?$/u and $data->{$1}
170 0 0 if $subtable =~ /^(.+) as (.+)/u
172 0 0 unless $data->{$subtable}
267 0 0 if ($map and $map->isa("Mojo::Upload"))
271 0 0 if (my($x, $y) = $hex =~ /^(\d\d)(\d\d)\s*empty$/cgu) { }
0 0 elsif (($x, $y) = $hex =~ /^(\d\d)(\d\d)\s+/cgu) { }
352 0 0 unless $map_data->{$coord}
358 0 0 if (same_direction($coord, $line, $line2->{'line'}))
364 0 0 if ($start and $same_dir)
371 0 0 if (not grep({$_ eq $type;} @{$$map_data{$coord};})) { }
0 0 elsif (not grep({$_ eq "$type-merge";} @{$$map_data{$coord};})) { }
386 0 0 if $merged
422 0 0 unless grep {$_ eq "$type-end";} @{$$map_data{$coord};}
424 0 0 unless $map_data->{$coord}
426 0 0 if grep {$_ eq "$type-merge";} @{$$map_data{$coord};}
475 295 1476 if ($i >= $roll)
476 0 295 if ($line->{'unique'})
502 10 0 unless $redirects and not $ENV{'HEX_DESCRIBE_OFFLINE'}
504 0 0 if $face_generator_url
505 0 0 if $text_mapper_url
508 0 0 if (not $res) { }
0 0 elsif ($res->code == 301 or $res->code == 302) { }
563 295 3 $context eq $word ? :
565 295 3 if ($table_data->{$key})
574 0 419 if ($last eq $text)
604 0 429 if $level > 20
605 0 429 if $level > 20
606 0 429 if ($level == 1)
609 0 0 if ($word =~ /^([a-z]+)="(.*)"/u or $word =~ /(.*)-(\d+)$/u) { }
622 35 394 if (my($just_save, $n, $d, $m, $p, $min, $max, $c, $save_as) = $word =~ /$dice_re/u) { }
0 394 elsif (my($save, $expression, $as) = $word =~ /$math_re/u) { }
0 394 elsif ($word =~ /^(\S+)\?\|\|(.*)/u) { }
0 394 elsif ($word =~ /^!(\S+)\|\|(.*)/u) { }
0 394 elsif (index($word, '||') != -1) { }
0 394 elsif (index($word, '|') != -1) { }
1 393 elsif ($word =~ /^name for an? /u) { }
0 393 elsif ($word =~ /^names for (\S+)/u) { }
0 393 elsif ($word =~ /^name for (\S+)/u) { }
0 393 elsif ($word eq 'adjacent hex') { }
1 392 elsif ($word =~ /^(?:nearby|other|later) ./u) { }
0 392 elsif ($word =~ /^append (.*)/u) { }
83 309 elsif ($word =~ /^same (.+)/u) { }
0 309 elsif ($word =~ /^(?:(here|global) )?with (.+?)(?: as (.+))?$/u) { }
0 309 elsif ($word =~ /^(?:(here|global) )?and (.+?)(?: as (.+))?$/u) { }
0 309 elsif ($word =~ /^capitalize (.+)/u) { }
0 309 elsif ($word =~ /^titlecase (.+)/u) { }
0 309 elsif ($word =~ /^highlightcase (.+)/u) { }
1 308 elsif ($word =~ /^normalize-elvish (.+)/u) { }
308 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}) { }
624 0 35 if ($c) { }
632 0 35 if defined $min and $r < $min
633 0 35 if defined $max and $r > $max
636 10 25 if $save_as
637 35 0 unless $just_save
640 0 0 if $as
641 0 0 unless $save
644 0 0 if $locals{$1}
647 0 0 unless $locals{$1}
653 0 0 if ($copy =~ /\S/u)
665 0 1 if $name
667 0 1 unless $name
674 0 0 if (my(@lines) = grep({$_->{'type'} eq $key;} @{$$extra{$coordinates};}))
680 0 0 unless ($name)
687 0 0 if (@names > 2) { }
0 0 elsif (@names == 2) { }
695 0 0 unless $list
696 0 0 unless $list
702 0 0 if (my(@lines) = grep({$_->{'type'} eq $key;} @{$$extra{$coordinates};})) { }
709 0 0 if $name
712 0 0 unless $name
723 0 0 if $name
726 0 0 unless $name
729 0 0 if %$map_data
733 0 0 $coordinates eq 'no map' ? :
742 0 0 unless $text
747 0 83 if exists $locals{$key} and ref $locals{$key} eq "ARRAY"
748 83 0 if exists $locals{$key}
749 0 0 if $globals->{$key} and $globals->{$key}{'global'}
752 0 0 if ($text) { }
762 0 0 unless $text
764 0 0 if $alias
765 0 0 if $where and $where eq "here"
766 0 0 if $where and $where eq "here" and $alias
767 0 0 if $where and $where eq "global"
768 0 0 if $where and $where eq "global" and $alias
777 0 0 if ref $locals{$key} ne "ARRAY"
778 0 0 if ref $locals{$key} ne "ARRAY"
779 0 0 if not $text or grep {$text eq $_;} @{$locals{$key};}
782 0 0 if $alias
783 0 0 if $where and $where eq "here"
784 0 0 if $where and $where eq "here" and $alias
785 0 0 if $where and $where eq "global"
786 0 0 if $where and $where eq "global" and $alias
790 0 0 unless ($found)
797 0 0 unless $text
803 0 0 unless $text
809 0 0 unless $text
815 0 1 unless $text
821 294 14 if (not $action or $action eq 'save') { }
828 74 234 unless $text
830 17 217 if $alias
831 4 230 if $where and $where eq "here"
832 4 0 if $where and $where eq "here" and $alias
833 0 234 if $where and $where eq "global"
834 0 4 if $where and $where eq "global" and $alias
835 220 14 if not $action or $action eq "quote"
848 0 0 unless defined $text
928 10 0 if ($images) { }
978 0 0 unless closest($map_data, $table_data, $coord, $1, $redirects)
997 0 0 if $_ ne $coordinates
998 0 0 unless (@coordinates)
1002 0 0 if (not $coordinates =~ /^\d+$/u) { }
1025 0 0 if (@_ == 2)
1032 0 0 if ($x1 > $x2)
1039 0 0 if ($y2 >= $y1) { }
1044 0 0 $x2 - $x1 > $y1 - $y2 ? :
1063 0 0 unless some_other($map_data, $table_data, $coord, $1, $redirects)
1082 0 0 unless (@coordinates)
1118 0 0 if $ref
1121 0 0 unless describe($map_data, $table_data, 1, $coord, [$key], $redirects) . $ref
1122 0 0 unless ($result)
1151 0 0 if $description
1160 0 0 if $description
1195 0 0 unless $line->{'type'} eq $type
1198 0 0 unless grep /$hex/u, @line
1243 0 0 unless ref $hex
1263 0 0 unless ref $hex
1267 0 0 if $map_data->{$neighbour}
1269 0 0 unless @neighbours
1282 0 0 if @arr == 1 and ref $arr[0] eq "ARRAY"
1303 0 0 if (not defined $min or $d < $min)
1326 0 0 if $from->[0] == $points[0][0] and $from->[1] == $points[0][1]
1347 0 0 if ($line1->[$i] eq $coord)
1354 0 0 if $i1 == 0 or $i1 > $#$line1
1357 0 0 if ($line2->[$i2] eq $coord)
1358 0 0 if ($$line2[$i2 - 1] and $next eq $$line2[$i2 - 1] or $$line2[$i2 + 1] and $next eq $$line2[$i2 + 1])
1389 0 0 if $seen{$coord} or not $map_data->{$coord}
1391 0 0 if (&intersect(\@keys, \@{$$map_data{$coord};}))
1393 0 0 if $names{"$word for $coord"}
1444 0 0 if (/^$/u) { }
0 0 elsif (/^$/u) { }
0 0 elsif (/^
  • $/u) { }
  • 0 0 elsif (m[^$]u) { }
    0 0 elsif (m[^$]u) { }
    1448 0 0 unless $str =~ /\n$/u