Branch Coverage

blib/lib/Game/HexDescribe/Utils.pm
Criterion Covered Total %
branch 99 326 30.3


line true false branch
62 0 0 if /^hex-describe-(.*)-table$/u
76 3 0 if -e $file
91 1 0 if -e $file
131 6237 115923 if ($line =~ /^;([^#\r\n]+)/u) { }
108561 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 108543 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|other|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 330 1377 if ($i >= $roll)
477 0 330 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 331 11 $context eq $word ? :
566 330 12 if ($table_data->{$key})
575 0 480 if ($last eq $text)
605 0 493 if $level > 20
606 0 493 if $level > 20
607 3 490 if ($level == 1)
610 0 4 if ($word =~ /^([a-z]+)="(.*)"/u or $word =~ /(.*)-(\d+)$/u) { }
623 41 453 if (my($just_save, $n, $d, $m, $p, $min, $max, $c, $save_as) = $word =~ /$dice_re/u) { }
0 453 elsif (my($save, $expression, $as) = $word =~ /$math_re/u) { }
0 453 elsif ($word =~ /^(\S+)\?\|\|(.*)/u) { }
0 453 elsif ($word =~ /^!(\S+)\|\|(.*)/u) { }
0 453 elsif (index($word, '||') != -1) { }
0 453 elsif (index($word, '|') != -1) { }
6 447 elsif ($word =~ /^name for an? /u) { }
0 447 elsif ($word =~ /^names for (\S+)/u) { }
0 447 elsif ($word =~ /^name for (\S+)/u) { }
0 447 elsif ($word eq 'adjacent hex') { }
1 446 elsif ($word =~ /^(?:nearby|other|later) ./u) { }
0 446 elsif ($word =~ /^append (.*)/u) { }
93 353 elsif ($word =~ /^same (.+)/u) { }
3 350 elsif ($word =~ /^(?:(here|global) )?with (.+?)(?: as (.+))?$/u) { }
2 348 elsif ($word =~ /^(?:(here|global) )?and (.+?)(?: as (.+))?$/u) { }
0 348 elsif ($word =~ /^capitalize (.+)/u) { }
0 348 elsif ($word =~ /^titlecase (.+)/u) { }
0 348 elsif ($word =~ /^highlightcase (.+)/u) { }
0 348 elsif ($word =~ /^normalize-elvish (.+)/u) { }
348 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 41 if ($c) { }
633 0 41 if defined $min and $r < $min
634 0 41 if defined $max and $r > $max
637 10 31 if $save_as
638 41 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 0 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 93 if exists $locals{$key} and ref $locals{$key} eq "ARRAY"
749 93 0 if exists $locals{$key}
750 0 0 if $globals->{$key} and $globals->{$key}{'global'}
753 0 0 if ($text) { }
763 0 3 unless $text
765 0 3 if $alias
766 0 3 if $where and $where eq "here"
767 0 0 if $where and $where eq "here" and $alias
768 0 3 if $where and $where eq "global"
769 0 0 if $where and $where eq "global" and $alias
778 0 2 if ref $locals{$key} ne "ARRAY"
779 0 2 if ref $locals{$key} ne "ARRAY"
780 0 2 if not $text or grep {$text eq $_;} @{$locals{$key};}
783 0 2 if $alias
784 0 2 if $where and $where eq "here"
785 0 0 if $where and $where eq "here" and $alias
786 0 2 if $where and $where eq "global"
787 0 0 if $where and $where eq "global" and $alias
791 0 2 unless ($found)
798 0 0 unless $text
804 0 0 unless $text
810 0 0 unless $text
816 0 0 unless $text
822 320 28 if (not $action or $action eq 'save') { }
829 80 268 unless $text
831 32 236 if $alias
832 2 266 if $where and $where eq "here"
833 2 6 if $where and $where eq "here" and $alias
834 6 262 if $where and $where eq "global"
835 6 2 if $where and $where eq "global" and $alias
836 237 31 if not $action or $action eq "quote"
849 0 0 unless defined $text
929 10 3 if ($images) { }
979 0 0 unless closest($map_data, $table_data, $coord, $1, $redirects)
998 0 0 if $_ ne $coordinates
999 0 0 unless (@coordinates)
1003 0 0 if (not $coordinates =~ /^\d+$/u) { }
1026 0 0 if (@_ == 2)
1033 0 0 if ($x1 > $x2)
1040 0 0 if ($y2 >= $y1) { }
1045 0 0 $x2 - $x1 > $y1 - $y2 ? :
1064 0 0 unless some_other($map_data, $table_data, $coord, $1, $redirects)
1083 0 0 unless (@coordinates)
1119 0 0 if $ref
1122 0 0 unless describe($map_data, $table_data, 1, $coord, [$key], $redirects) . $ref
1123 0 0 unless ($result)
1152 2 0 if $description
1161 1 0 if $description
1196 0 0 unless $line->{'type'} eq $type
1199 0 0 unless grep /$hex/u, @line
1244 0 0 unless ref $hex
1264 0 0 unless ref $hex
1268 0 0 if $map_data->{$neighbour}
1270 0 0 unless @neighbours
1283 0 0 if @arr == 1 and ref $arr[0] eq "ARRAY"
1304 0 0 if (not defined $min or $d < $min)
1327 0 0 if $from->[0] == $points[0][0] and $from->[1] == $points[0][1]
1348 0 0 if ($line1->[$i] eq $coord)
1355 0 0 if $i1 == 0 or $i1 > $#$line1
1358 0 0 if ($line2->[$i2] eq $coord)
1359 0 0 if ($$line2[$i2 - 1] and $next eq $$line2[$i2 - 1] or $$line2[$i2 + 1] and $next eq $$line2[$i2 + 1])
1390 0 0 if $seen{$coord} or not $map_data->{$coord}
1392 0 0 if (&intersect(\@keys, \@{$$map_data{$coord};}))
1394 0 0 if $names{"$word for $coord"}
1445 0 122 if (/^$/u) { }
0 122 elsif (/^$/u) { }
0 122 elsif (/^
  • $/u) { }
  • 0 122 elsif (m[^$]u) { }
    0 122 elsif (m[^$]u) { }
    1449 0 0 unless $str =~ /\n$/u