Branch Coverage

blib/lib/Game/HexDescribe/Utils.pm
Criterion Covered Total %
branch 104 326 31.9


line true false branch
62 0 0 if /^hex-describe-(.*)-table$/u
76 7 0 if -e $file
91 1 0 if -e $file
131 14553 270494 if ($line =~ /^;([^#\r\n]+)/u) { }
253316 17178 elsif ($key and ($c, $t) = $line =~ /^(\d+),(.*)/u) { }
0 32053 elsif ($line ne '' and not $line =~ /^\s*#/u) { }
133 0 14553 if exists $data->{$key}
139 42 253274 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|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 395 17012 if ($i >= $roll)
477 0 395 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 396 18 $context eq $word ? :
566 395 19 if ($table_data->{$key})
575 0 550 if ($last eq $text)
605 0 569 if $level > 20
606 0 569 if $level > 20
607 3 566 if ($level == 1)
610 0 4 if ($word =~ /^([a-z]+)="(.*)"/u or $word =~ /(.*)-(\d+)$/u) { }
623 42 528 if (my($just_save, $n, $d, $m, $p, $min, $max, $c, $save_as) = $word =~ /$dice_re/u) { }
0 528 elsif (my($save, $expression, $as) = $word =~ /$math_re/u) { }
0 528 elsif ($word =~ /^(\S+)\?\|\|(.*)/u) { }
0 528 elsif ($word =~ /^!(\S+)\|\|(.*)/u) { }
0 528 elsif (index($word, '||') != -1) { }
0 528 elsif (index($word, '|') != -1) { }
7 521 elsif ($word =~ /^name for an? /u) { }
0 521 elsif ($word =~ /^names for (\S+)/u) { }
0 521 elsif ($word =~ /^name for (\S+)/u) { }
0 521 elsif ($word eq 'adjacent hex') { }
0 521 elsif ($word =~ /^(?:nearby|closest|other|later) ./u) { }
0 521 elsif ($word =~ /^append (.*)/u) { }
95 426 elsif ($word =~ /^same (.+)/u) { }
2 424 elsif ($word =~ /^(?:(here|global) )?with (.+?)(?: as (.+))?$/u) { }
2 422 elsif ($word =~ /^(?:(here|global) )?and (.+?)(?: as (.+))?$/u) { }
1 421 elsif ($word =~ /^capitalize (.+)/u) { }
0 421 elsif ($word =~ /^titlecase (.+)/u) { }
0 421 elsif ($word =~ /^highlightcase (.+)/u) { }
6 415 elsif ($word =~ /^normalize-elvish (.+)/u) { }
415 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 42 if ($c) { }
633 0 42 if defined $min and $r < $min
634 0 42 if defined $max and $r > $max
637 10 32 if $save_as
638 42 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 95 if exists $locals{$key} and ref $locals{$key} eq "ARRAY"
749 95 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 5 if ref $locals{$key} ne "ARRAY"
772 0 5 if ref $locals{$key} ne "ARRAY"
773 3 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 1 unless $text
797 0 0 unless $text
803 0 0 unless $text
809 0 6 unless $text
815 382 33 if (not $action or $action eq 'save') { }
822 79 336 unless $text
824 41 295 if $alias
825 7 329 if $where and $where eq "here"
826 7 6 if $where and $where eq "here" and $alias
827 6 330 if $where and $where eq "global"
828 6 7 if $where and $where eq "global" and $alias
829 300 36 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)
1114 0 0 if $ref
1117 0 0 unless describe($map_data, $table_data, 1, $coord, [$key], $redirects) . $ref
1118 0 0 unless ($result)
1147 2 0 if $description
1156 1 0 if $description
1191 0 0 unless $line->{'type'} eq $type
1194 0 0 unless grep /$hex/u, @line
1239 0 0 unless ref $hex
1259 0 0 unless ref $hex
1263 0 0 if $map_data->{$neighbour}
1265 0 0 unless @neighbours
1278 0 0 if @arr == 1 and ref $arr[0] eq "ARRAY"
1299 0 0 if (not defined $min or $d < $min)
1322 0 0 if $from->[0] == $points[0][0] and $from->[1] == $points[0][1]
1343 0 0 if ($line1->[$i] eq $coord)
1350 0 0 if $i1 == 0 or $i1 > $line1->$#*
1353 0 0 if ($line2->[$i2] eq $coord)
1354 0 0 if ($$line2[$i2 - 1] and $next eq $$line2[$i2 - 1] or $$line2[$i2 + 1] and $next eq $$line2[$i2 + 1])
1385 0 0 if $seen{$coord} or not $map_data->{$coord}
1387 0 0 if (&intersect(\@keys, \@{$$map_data{$coord};}))
1389 0 0 if $names{"$word for $coord"}
1440 0 128 if (/^$/u) { }
0 128 elsif (/^$/u) { }
0 128 elsif (/^
  • $/u) { }
  • 0 128 elsif (m[^$]u) { }
    0 128 elsif (m[^$]u) { }
    1445 0 0 @list > 1 ? :
    1449 0 0 unless $str =~ /\n$/u