Branch Coverage

lib/Graph/Easy.pm
Criterion Covered Total %
branch 360 518 69.5


line true false branch
69 3 909 if (@_ == 1 and not ref $_[0])
74 0 3 unless (defined $self)
87 107 802 if ref $args ne 'HASH'
103 1511 0 if (ref $n)
111 1065 0 if (ref $e)
120 62 0 if (ref $g)
220 0 2407 unless ($k =~ /^(timeout|debug|strict|fatal_errors|undirected)\z/)
224 1 0 if ($k eq 'undirected' and $args->{$k})
232 0 909 if $self->{'debug'}
248 196 3 if @_
256 47 0 if @_
264 439 3 if @_
273 20 0 unless $self->{'att'}{'type'}
285 3 23 if exists $count{$id}
297 3 1 $self->attribute('type') eq 'directed' ? :
305 2 2 $self->attribute('type') eq 'undirected' ? :
312 1 1 if defined $_[0]
339 0 502 if defined $root
353 0 0 if keys %{$$node{'edges'};} != 0 and not $node->has_predecessors
367 0 0 if keys %{$$node{'edges'};} == 0 or not $node->has_predecessors
376 273 32 unless defined $label
377 9 296 if not $_[0] and $label =~ /\\[EGHNT]/
387 391 18 if $link eq ''
388 391 18 if ($link eq '' and $autolink ne '')
390 114 277 if $autolink eq 'name'
392 0 391 if $autolink eq 'label' and defined $self->{'att'}{'label'}
393 0 391 if $autolink eq 'label' and not defined $self->{'att'}{'label'}
395 37 372 unless defined $link
398 85 324 if ($link ne '' and not $link =~ m[^([\w]{3,4}://|/)])
403 0 409 if not $_[0] and $link =~ /\\[EGHNT]/
418 0 0 if @_ > 0
430 429 424 unless wantarray
442 1 0 unless (wantarray)
447 0 0 if $node->is_anon
455 0 0 if $node->is_anon
467 36 463 unless wantarray
479 0 0 unless wantarray
489 0 1056 unless wantarray
491 108 948 unless defined $f1
494 1 610 unless defined $f2 or $f1 =~ /^(name|id)$/
497 1056 0 if $f1
498 216 840 if $f1 and $f1 eq 'rank'
499 230 826 if $f1 and $f1 =~ /^(name|title|label)$/
500 0 0 unless $Graph::Easy::a->{$f1} <=> $Graph::Easy::b->{$f1}
446 610 if $f2
501 1 3 unless abs $Graph::Easy::a->{$f1} <=> abs $Graph::Easy::b->{$f1}
216 840 if $f2 and $f1 eq 'rank'
502 0 0 unless $Graph::Easy::a->{$f1} <=> $Graph::Easy::b->{$f1}
0 1056 if $f2 and $f2 eq 'rank'
503 0 0 unless $Graph::Easy::a->{$f1} <=> $Graph::Easy::b->{$f1}
215 841 if $f2 and $f2 =~ /^(name|title|label)$/
505 558 698 unless abs $Graph::Easy::a->{$f1} <=> abs $Graph::Easy::b->{$f1}
506 215 1 if $f1 and $f1 eq 'rank' and $f2 and $f2 =~ /^(name|title|label)$/
509 0 1258 unless $Graph::Easy::a->{$f1} cmp $Graph::Easy::b->{$f1}
230 216 if $f2 and $f2 eq 'id' and $f1 ne 'rank'
522 0 1 if ref $edge
525 1 0 unless ref $x
526 1 0 unless ref $y
529 1 0 if (ref $x1 and ref $y1)
533 1 0 if @ids
545 10 524 unless ref $x
546 10 524 unless ref $y
549 0 534 unless ref $x and ref $y
553 516 18 wantarray ? :
562 0 0 unless ref $x
563 0 0 unless ref $y
568 0 0 unless ref $x and ref $y and $x != $y
572 0 0 if $e->{'from'} == $x and $e->{'to'} == $y
582 0 416 unless defined $name
592 3 2 unless ref $node
594 1 4 if (not ref $node) { }
600 1 3 if (not ref $node->{'graph'}) { }
608 1 2 if ($node->{'graph'} != $self) { }
622 0 5 if ($node->is_anon)
626 0 0 if $node->{'att'}{'label'} eq ' '
637 0 0 if (not ref $group) { }
643 0 0 if (not ref $group->{'graph'}) { }
651 0 0 if ($group->{'graph'} != $self) { }
665 0 0 if ($group->is_anon)
669 0 0 if $group->{'att'}{'label'} eq ''
691 3 1794 unless $class =~ /^(\.\w|node|group|edge|graph\z)/
693 1 1793 if $class =~ /\.\z/
698 10 1783 if ($base_class eq '') { }
716 551 875 if (@_ == 3)
724 250 1176 if exists $att_aliases->{$name}
726 0 1426 unless defined $name
727 0 1426 unless defined $val
731 0 1426 if @classes == 0
738 97 1329 if ($self->{'strict'})
741 1 96 if defined $rc
750 674 751 if ($class eq 'graph')
752 0 674 if ($name =~ /^g?id\z/)
757 2 672 if ($name eq 'output')
765 816 609 unless ref $att->{$class}
767 8 1417 if ($name eq 'border')
791 22 116 if (defined $class_selector and not defined $att)
798 0 138 if @classes == 0
816 1 196 if (@_ == 2)
822 2 195 if exists $att_aliases->{$name}
826 0 197 if @classes == 0
834 0 197 if ($name eq 'size')
839 0 197 if ($name eq 'border')
874 193 86 unless defined $flow
876 6 80 unless defined $f
890 0 4 if $_[0]
904 0 5 unless $self->can($method)
925 20 0 unless defined $indent
926 20 0 if $indent2 eq ''
929 20 0 if (defined $overlay)
951 76 44 unless ref $a->{$class}
955 540 0 unless exists $acc->{$k}
969 43 695 if ($class =~ /^$primary\.(.*)/)
976 20 0 unless defined $base
983 0 123 unless %{$a->{$class};}
987 16 107 if $class eq 'group' and $groups == 0
991 0 107 if ($class eq 'graph' and $base eq '') { }
20 87 elsif ($class eq 'graph') { }
1001 87 0 unless ($c =~ /\./)
1005 24 63 if $cls ne ''
1013 42 442 if $att =~ /$skip/ or $att eq 'border'
1017 10 64 if $class eq 'graph' and $base ne '' and $att =~ /^(color|font|fontsize|align|fill)\z/
1022 0 432 unless defined $val
1026 4 428 if $att eq 'borderstyle' and $class eq 'group'
1028 4 428 if $att eq 'borderwidth' and not $val =~ /(px|em|%)\z/
1033 228 204 if (defined $entry)
1036 92 136 if ($type == 1)
1043 181 251 if (exists $map->{$att})
1045 156 25 unless ref $map->{$att}
1046 25 156 if ref $map->{$att}
1050 32 336 if ($class ne 'graph' and $att and $val and $val eq 'inherit')
1055 0 32 unless $base_class =~ /\./
1060 32 0 if ($base_class ne 'graph' and !defined($val) || $val eq 'inherit')
1064 32 0 unless defined $val
1068 400 32 if defined $att and defined $val
1072 107 0 if $done > 0
1093 1 0 if $style ne 'auto'
1103 25 0 unless $class =~ /edge/
1141 4 16 if @groups > 0
1206 20 0 if keys %{$$self{'edges'};} > 0
1212 5 51 if $n->shape =~ /circle|ellipse|rounded/
1220 4 16 if $rounded > 0
1224 4 16 if (@groups > 0)
1265 10 0 unless defined $css
1267 10 0 if $css ne ''
1278 10 0 unless defined $title
1279 7 3 unless defined $title
1281 0 10 if not $_[0] and $title =~ /\\[EGHNTL]/
1309 24 5 unless defined $caption and $caption ne ''
1314 0 5 if $bg
1318 0 5 if $f ne ''
1322 0 5 if $c
1328 5 0 unless $style eq ' style="'
1334 0 5 if ($link ne '')
1354 27 2 unless defined $self->{'score'}
1370 75 0 if not defined $max_x or $x > $max_x
1371 25 50 if not defined $min_x or $x < $min_x
1379 4 25 unless defined $max_x
1407 0 75 unless (exists $rows->{$y}{$x})
1414 0 75 if $node->isa('Graph::Easy::Node::Cell')
1418 25 50 if (ref $h eq 'ARRAY') { }
1439 0 147 unless defined $_
1452 0 0 if $row->[$i] =~ /border(:|-left)/
1463 0 0 if $row->[$i] =~ /(row|col)span.*\1span/m
1470 0 0 if ($j > $i + 1)
1480 0 0 unless $row->[$i] =~ /colspan/
1495 51 49 unless ($r =~ s/^[\s\n]*\z//)
1510 29 0 if defined $caption
1512 2 27 if $pos eq 'bottom'
1513 3 26 if $pos eq 'top'
1556 0 0 unless defined $self->{'score'}
1584 0 251 ref $_[0] eq 'HASH' ? :
1589 248 3 unless defined $self->{'score'}
1607 11 240 if (@$label > 0)
1614 9 2 if $label_pos eq 'top'
1616 0 11 if $self->{'debug'}
1622 2 31 if length $l > $max_x + 2
1627 0 251 if $self->{'debug'}
1633 11 240 if (@$label > 0)
1635 2 9 if $label_pos eq 'bottom'
1642 618 3509 if $v->isa('Graph::Easy::Node::Cell')
1652 0 9786 if length $lines[$i] == 0
1654 237 9549 unless defined $$fb[$y + $i]
1661 14 3216 unless defined $fb->[$y]
1713 0 0 if ($Graph::Easy::As_svg::VERSION)
1766 0 0 unless $self->{'svg_info'}
1790 140 1017 unless defined $edge
1791 5 1152 unless ref $edge
1794 0 1157 if exists $self->{'edges'}{$edge->{'id'}}
1797 0 1157 if ref $edge->{'graph'} and $edge->{'graph'} != $self
1802 0 1157 unless defined $x and defined $y
1806 1053 104 if ref $x
1807 1053 104 if ref $y
1814 1066 91 if exists $nodes->{$xn}
1815 1050 107 if exists $nodes->{$yn}
1817 67 1090 unless ref $x
1818 2 1155 if not ref $y and $y eq $xn
1819 69 1088 unless ref $y
1821 0 1157 if $self->{'debug'}
1826 0 2314 if ref $n->{'graph'} and $n->{'graph'} != $self
1834 84 1073 unless ref $x->{'graph'}
1835 97 1060 unless ref $y->{'graph'}
1836 1157 0 unless ref $edge->{'graph'}
1847 7 1150 if $x->isa('Graph::Easy::Group')
1849 7 1150 if $y->isa('Graph::Easy::Group')
1857 59 1098 wantarray ? :
1864 0 0 if @_ > 0
1878 68 2075 if (ref $x)
1880 0 68 unless defined $n
1883 0 2143 if $n eq ''
1886 0 68 if ref $x and ref $x->{'graph'} and $x->{'graph'} != $self
1890 650 1493 if exists $no->{$n}
1893 1449 44 unless ref $x
1903 1493 0 unless ref $x->{'graph'}
1918 0 3 if (ref $x)
1920 0 0 unless defined $n
1923 0 3 if $n eq ''
1926 0 0 if ref $x and ref $x->{'graph'} and $x->{'graph'} != $self
1930 2 1 if exists $no->{$n}
1935 1 0 unless ref $x
1945 1 0 unless ref $xx->{'graph'}
1969 58 37 unless ref $self->{$k}
1984 2 4 if $n->{'group'}
2007 0 18 if (ref $k eq 'HASH') { }
0 18 elsif (ref $k) { }
2029 4 1 unless ref $A
2030 4 1 unless ref $B
2033 1 4 if ref $B->{'group'}
2040 2 6 unless $edge->{'to'} == $B
2050 2 4 if $edge->{'to'} == $A or $edge->{'to'} == $B and $edge->{'from'} == $B
2054 3 1 if $edge->{'from'} == $B
2055 1 3 if $edge->{'to'} == $B
2064 2 3 if defined $joiner
2079 1 48 unless ref $node
2082 0 49 unless ref $node
2085 1 48 if ref $node->{'group'}
2098 0 6 if $from != $node
2099 5 1 if $to != $node
2111 1 48 if defined $node->{'origin'}
2122 0 10 unless ref $edge
2125 2 8 if ref $edge->{'group'}
2154 38 59 unless ref $group
2157 34 63 unless ref $group
2198 1015 590 if wantarray
2211 6 29 if not defined $level or $level < 0
2214 6 29 if ($level == -1)
2216 0 6 if wantarray
2222 2 27 $self->{'graph'} ? :
2230 11 24 if $are_graph and not defined $g->{'group'} or $g->{'group'} == $self
2233 23 6 if ($level == 0)
2235 20 3 wantarray ? :
2246 0 6 wantarray ? :
2256 0 0 unless (wantarray)
2261 0 0 if $group->is_anon
2269 0 0 if $group->is_anon
2279 0 1317 unless $object =~ /^(node|group|edge)\z/
2345 2 1 unless ref $x
2346 3 0 unless ref $y
2349 1 2 unless ref $x and ref $y
2351 2 0 scalar $x->edges_to($y) ? :