Branch Coverage

blib/lib/Tree/Nary.pm
Criterion Covered Total %
branch 126 262 48.0


line true false branch
73 17 4751 if (defined $newdata)
92 0 0 if (defined $$parent{'children'})
95 0 0 if (defined $$parent{'next'}) { }
110 2702 0 unless (defined $root)
113 0 0 unless ($self->is_root($root))
127 0 10 unless (defined $node)
131 7 3 if (defined $$node{'prev'}) { }
3 0 elsif (defined $$node{'parent'}) { }
139 5 5 if (defined $$node{'next'})
175 0 2 unless (defined $node)
178 0 2 unless (defined $descendant)
183 1 2 if (defined $$descendant{'parent'} and $$descendant{'parent'} == $node)
198 0 0 unless (defined $node)
230 0 2 unless (defined $node)
260 0 2067 unless (defined $root)
270 826 1237 if ($tmp_height > $max_height)
286 0 22 unless (defined $node)
308 0 4 unless (defined $node)
311 0 4 unless (defined $child)
314 0 4 if (defined $$child{'parent'} and not $$child{'parent'} == $node)
321 4 6 if ($node == $child)
337 0 0 unless (defined $node)
344 0 0 if ($$node{'data'} eq $data)
359 0 0 unless (defined $node)
375 0 0 unless (defined $node)
387 0 0 unless (defined $node)
399 0 0 unless (defined $node)
418 422 1660 if (defined $$node{'children'}) { }
1653 7 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS) { }
422 418 4 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS)
446 0 4 unless (defined $root)
449 0 4 unless ($flags <= $Tree::Nary::TRAVERSE_MASK)
463 0 2 unless (defined $node)
475 0 2 unless (defined $node)
481 2 0 if (defined $node)
497 0 10 unless (defined $node)
503 10 0 if (defined $node)
521 0 4 unless (defined $parent)
524 0 4 unless (defined $node)
527 0 4 unless ($self->is_root($node))
531 3 1 if ($position > 0) { }
1 0 elsif ($position == 0) { }
545 0 2073 unless (defined $parent)
548 0 2073 unless (defined $node)
551 0 2073 unless ($self->is_root($node))
555 13 2060 if (defined $sibling)
556 0 13 if ($$sibling{'parent'} != $parent)
563 13 2060 if (defined $sibling) { }
564 2 11 if (defined $$sibling{'prev'}) { }
575 1643 417 if (defined $$parent{'children'}) { }
629 0 13 unless (defined $parent)
652 8 14 if (defined $$node{'children'}) { }
0 21 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS and &$funcref($node, $argref)) { }
656 0 8 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($node, $argref))
668 0 20 if ($self->_traverse_pre_order($current, $flags, $funcref, $argref))
684 0 0 if (defined $$node{'children'}) { }
0 0 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS and &$funcref($node, $argref)) { }
688 0 0 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($node, $argref))
693 0 0 unless ($depth)
706 0 0 if ($self->_traverse_pre_order($current, $flags, $depth, $funcref, $argref))
722 4 7 if (defined $$node{'children'}) { }
0 7 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS and &$funcref($node, $argref)) { }
735 0 10 if ($self->_traverse_post_order($current, $flags, $funcref, $argref))
740 0 4 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($node, $argref))
755 0 0 if (defined $$node{'children'}) { }
0 0 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS and &$funcref($node, $argref)) { }
758 0 0 if ($depth)
771 0 0 if ($self->_depth_traverse_post_order($current, $flags, $depth, $funcref, $argref))
776 0 0 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($node, $argref))
791 8 13 if (defined $$node{'children'}) { }
1 12 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS and &$funcref($node, $argref)) { }
800 1 7 if ($self->_traverse_in_order($current, $flags, $funcref, $argref))
803 0 7 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($node, $argref))
810 2 9 if ($self->_traverse_in_order($current, $flags, $funcref, $argref))
826 0 0 if (defined $$node{'children'}) { }
0 0 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS and &$funcref($node, $argref)) { }
829 0 0 if ($depth) { }
0 0 elsif ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($node, $argref)) { }
838 0 0 if ($self->_depth_traverse_in_order($current, $flags, $depth, $funcref, $argref))
841 0 0 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($node, $argref))
848 0 0 if ($self->_depth_traverse_in_order($current, $flags, $depth, $funcref, $argref))
878 15 35 if (defined $$current{'children'}) { }
0 42 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS and &$funcref($current, $argref)) { }
879 0 15 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($current, $argref))
896 0 50 if (defined $$current{'children'} and $self->_traverse_children($current, $flags, $funcref, $argref))
918 0 0 if (defined $$current{'children'}) { }
0 0 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS and &$funcref($current, $argref)) { }
920 0 0 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($current, $argref))
930 0 0 unless ($depth)
943 0 0 if (defined $$current{'children'} and $self->_depth_traverse_children($current, $flags, $depth, $funcref, $argref))
957 0 10 unless (defined $root)
960 0 10 unless (defined $funcref)
963 0 10 unless ($order <= $Tree::Nary::LEVEL_ORDER)
966 0 10 unless ($flags <= $Tree::Nary::TRAVERSE_MASK)
969 0 10 unless ($depth == -1 or $depth > 0)
975 2 8 if ($order == $Tree::Nary::PRE_ORDER)
977 2 0 if ($depth < 0) { }
984 1 7 if ($order == $Tree::Nary::POST_ORDER)
986 1 0 if ($depth < 0) { }
993 2 5 if ($order == $Tree::Nary::IN_ORDER)
995 2 0 if ($depth < 0) { }
1002 5 0 if ($order == $Tree::Nary::LEVEL_ORDER)
1004 5 0 if (defined $$root{'children'}) { }
0 0 elsif ($flags & $Tree::Nary::TRAVERSE_LEAFS) { }
1005 5 0 unless ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS and &$funcref($root, $argref))
1006 5 0 if ($depth < 0) { }
1010 0 0 if ($depth)
1029 0 2 unless (defined $root)
1032 0 2 unless ($order <= $Tree::Nary::LEVEL_ORDER)
1035 0 2 unless ($flags <= $Tree::Nary::TRAVERSE_MASK)
1050 9 1 if ($$ref_of_array[0] ne $$node{'data'})
1069 0 1 unless (defined $node)
1072 0 1 unless ($flags <= $Tree::Nary::TRAVERSE_MASK)
1080 1 1 if ($$node{'data'} eq $data)
1081 0 1 if ($self->is_leaf($node)) { }
1082 0 0 if ($flags & $Tree::Nary::TRAVERSE_LEAFS)
1086 1 0 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS)
1104 0 12 unless (defined $node)
1107 0 12 unless ($flags <= $Tree::Nary::TRAVERSE_MASK)
1110 0 12 unless (defined $funcref)
1123 23 7 if ($self->is_leaf($current)) { }
1124 23 0 if ($flags & $Tree::Nary::TRAVERSE_LEAFS)
1128 7 0 if ($flags & $Tree::Nary::TRAVERSE_NON_LEAFS)
1155 7 4 if $self->is_leaf($node)
1181 4 8 unless ($self->is_leaf($node))
1208 0 6 if $self->is_leaf($t1) and not $self->is_leaf($t2) or not $self->is_leaf($t1) and $self->is_leaf($t2)
1212 0 6 if $self->n_children($t1) != $self->n_children($t2)
1216 0 6 if $$t1{'data'} ne $$t2{'data'}
1217 4 2 if $self->is_leaf($t1)
1226 5 0 if $self->is_identical($t1childs[$i], $t2childs[$i]) == $Tree::Nary::TRUE
1240 1 0 if $t1c eq $t2c