Branch Coverage

blib/lib/XBase/Index.pm
Criterion Covered Total %
branch 175 380 46.0


line true false branch
34 0 16 if $XBase::Index::VERBOSE
35 6 10 if (ref $class)
39 1 15 if ($ext eq 'sdbm' or $ext eq 'pag' or $ext eq 'dir')
45 16 0 if defined $object
47 0 0 if $@
54 182 45 if defined $$self{'pages_cache'}{$num}
60 45 0 if (defined $page)
64 0 45 if $XBase::Index::DEBUG
65 0 28 if defined $$page{'lefts'} and $XBase::Index::DEBUG
86 14 1520 unless (defined $level)
89 0 14 unless (defined $page)
100 0 1534 unless (defined $page)
108 142 1392 if (not defined $row) { }
118 118 1416 if (defined $left)
124 0 118 unless (defined $page)
139 1212 204 if (defined $val) { }
147 51 153 if $level < 0
149 0 153 unless (defined $page)
160 103 44 if (not defined $$page{'last_key_is_just_overflow'} and defined $backleft and defined $backval)
171 1 0 if defined $$self{'tags'}
209 2 57 $$self{'key_type'} ? :
213 0 95 unless (defined $page)
234 0 584 unless (defined $key)
236 52 532 $numdate == 1 ? :
85 499 if ($numdate == 1 ? $key >= $eq : $key ge $eq)
246 59 36 if ($empty or not defined $left)
247 46 13 $row ? :
251 2 34 if defined $parent
255 10 49 if (defined $recno)
259 0 20 $numdate ? :
10 10 if $numdate ? $key > $eq : $key gt $eq
262 0 10 if $val == $recno
279 0 2301 if $XBase::Index::DEBUG > 5
282 2079 222 if $num <= $#{$$self{'keys'};}
293 0 5 if $XBase::Index::VERBOSE
294 0 5 unless $self->prepare_select_eq($key, $value)
297 0 5 if (defined $foundvalue and $foundkey eq $key and $foundvalue == $value)
302 0 5 if $XBase::Index::VERBOSE
307 0 5 if $XBase::Index::VERBOSE
309 0 5 unless $self->prepare_select_eq($key, $value)
312 0 5 if (defined $foundvalue and $foundkey eq $key and $foundvalue == $value)
323 0 0 if $XBase::Index::VERBOSE
333 0 0 if ($$self{'rows'}[$level] < 0)
341 0 0 if $XBase::Index::DEBUG
346 0 5 if $XBase::Index::VERBOSE
350 0 5 unless defined $row
355 5 0 if defined $$page{'lefts'}
361 0 5 if $XBase::Index::DEBUG
380 0 3 unless ($$self{'fh'}->read($header, 512) == 512)
408 0 15 if (ref($indexfile) =~ /::Page$/)
413 0 15 unless my $data = $indexfile->read_record($num)
419 0 15 if $XBase::ndx::Page::DEBUG
431 110 37 if ($numdate)
432 0 110 if $XBase::Index::BIGEND
435 0 147 if $XBase::ndx::Page::DEBUG > 1
437 109 38 $recno ? :
438 39 108 $left ? :
441 5 142 if ($i == 0 and defined $left)
454 3 12 if ($num == $$indexfile{'start_page'} or defined $$parent{'last_key_is_just_overflow'} and $$parent{'lefts'}[$#{$$parent{'lefts'};}] == $num)
478 0 1 unless ($$self{'fh'}->read($header, 1024) == 1024)
489 0 1 if ($$self{'signature'} != 3 and $$self{'signature'} != 6)
499 0 1 if (defined $opts{'type'}) { }
1 0 elsif (defined $$self{'dbf'}) { }
503 0 1 unless (defined $field_type)
511 0 1 $field_type =~ /^[NDIF]$/ ? :
532 0 9 if (ref($indexfile) =~ /::Page$/)
536 0 9 unless my $data = $indexfile->read_record($num)
546 0 9 if $XBase::ntx::Page::DEBUG
555 0 69 if ($numdate)
559 0 0 if ($key =~ tr/"-,/99876543210/)
563 0 69 if $XBase::ntx::Page::DEBUG > 1
565 68 1 $recno ? :
566 8 61 $left ? :
570 1 68 if ($i == 0 and defined $left)
597 0 2 unless ($$self{'fh'}->read($header, 512) == 512)
611 1 1 if ($opts{'type'} eq 'N')
625 0 2 unless (defined $type)
629 1 1 if $type eq 'N' or $type eq 'D'
632 0 2 unless $self->create_file($filename)
635 1 1 if $numdate
641 1 1 if ($numdate) { }
644 8 0 unless $XBase::Index::BIGEND
645 2 6 if ((substr($key, 0, 1) & "\200") eq "\200") { }
674 0 3 if $pageno > 5
676 2 1 if $level == 1
677 2 1 if (scalar @data < $count)
692 4 14 if ($current_count == $count or $i == $#data)
696 1 3 if ($i < $#data)
739 0 4 if (ref($indexfile) =~ /::Page$/)
743 0 4 unless my $data = $indexfile->read_record($num)
749 0 4 if $XBase::idx::Page::DEBUG
761 3 16 unless ($attributes & 2)
765 0 19 if $XBase::idx::Page::DEBUG > 1
768 8 11 if ($numdate)
769 2 6 if ((substr($key, 0, 1) & "\200") ne "\200") { }
774 8 0 unless ($XBase::Index::BIGEND)
777 0 19 if $XBase::idx::Page::DEBUG > 1
779 16 3 $recno ? :
780 2 17 $left ? :
783 1 18 if ($i == 0 and defined $left)
817 0 0 unless ($$self{'fh'}->read($header, 544) == 544)
831 0 0 unless ($self->seek_to(544 + ($i - 1) * $len))
834 0 0 unless ($$self{'fh'}->read($header, $len) == $len)
845 0 0 unless ($self->seek_to($$tag{'header_page'} * 512))
848 0 0 unless ($$self{'fh'}->read($header, 24) == 24)
858 0 0 if (defined $expr_name)
859 0 0 if (defined $$self{'tags'}{$expr_name}) { }
876 0 0 if defined $$self{'tags'}
892 0 0 if (ref($indexfile) =~ /::Page$/)
896 0 0 unless $indexfile->seek_to_record($num)
898 0 0 unless $$indexfile{'fh'}->read($data, 1024) == 1024
906 0 0 if $XBase::mdx::Page::DEBUG
923 0 0 if $offset <= 1020
925 0 0 if ($right) { }
972 9 9 unless exists $$self{'dbf'}
976 0 18 unless ($$self{'fh'}->read($header, 1024) == 1024)
1006 9 9 unless (defined $$self{'tag'})
1015 9 9 if (defined $opts{'tag'})
1019 0 9 if (not defined $foundkey or $opts{'tag'} ne $foundkey)
1023 0 9 if $XBase::cdx::DEBUG
1031 0 9 if (defined $opts{'type'}) { }
9 0 elsif (defined $$subidx{'dbf'}) { }
1036 0 9 unless (defined $field_type)
1045 0 9 $field_type =~ /^[NDIF]$/ ? :
1046 0 9 if ($field_type eq 'D')
1074 0 17 unless (my $data = $indexfile->read_record($num))
1083 0 17 if $XBase::cdx::Page::DEBUG
1090 17 0 if ($attributes & 2) { }
1091 0 17 if $XBase::cdx::Page::DEBUG
1095 0 17 if $XBase::cdx::Page::DEBUG > 2
1108 0 295 if $XBase::cdx::Page::DEBUG > 3
1122 0 295 if $XBase::cdx::Page::DEBUG > 6
1126 176 119 if $getlength
1128 176 119 if $getlength
1132 0 295 if ($numdate) { }
1134 0 0 if (128 & unpack('C', $key)) { }
1138 0 0 if ($keylength == 8) { }
1139 0 0 unless $XBase::Index::BIGEND
1144 0 0 if ($numdate == 2 and $key)
1149 255 40 if $trail
1152 0 295 if $XBase::cdx::Page::DEBUG > 4
1162 0 0 if ($numdate) { }
1163 0 0 if (128 & unpack('C', $key)) { }
1171 0 0 if ($keylength == 8) { }
1172 0 0 unless $XBase::Index::BIGEND
1177 0 0 if ($numdate == 2 and $key)
1184 0 0 if $XBase::cdx::Page::DEBUG > 4
1187 0 0 unless defined $lefts
1217 0 0 if (not defined $indexfile and ref $class)
1223 0 0 if ($position % 512)
1249 22 0 if ($attributes & 2) { }
1253 22 0 if (defined $$self{'recno_count'})
1277 0 424 if ($numdate)
1278 0 0 if ($keylength == 8) { }
1280 0 0 unless $XBase::Index::BIGEND
1286 0 0 if (not 128 & unpack('C', $out)) { }
1293 265 1257 unless (substr($out, $i, 1) eq substr($prevkey, $i, 1))
1336 0 0 if ($numdate)
1337 0 0 if ($keylength == 8) { }
1339 0 0 unless $XBase::Index::BIGEND
1345 0 0 if (not 128 & unpack('C', $out)) { }
1366 0 0 if length $data > 512
1377 0 5 if $XBase::cdx::Page::DEBUG
1386 0 5 unless (@{$$self{'keys'};})
1390 0 0 if $self_num == $$indexfile{'start_page'}
1397 0 0 if ($right_brother_num != 4294967295)
1402 0 0 if ($left_brother_num != 4294967295)
1409 0 0 unless my $parent = $self->get_parent_page
1414 0 0 if ($$parent{'lefts'}[$i] == $self_num)
1421 0 0 if ($i > $maxindex)
1429 0 5 if (length $data > 512) { }
0 5 elsif ($self_num != $$indexfile{'start_page'}) { }
1442 0 0 if ($half_rows == 0)
1443 0 0 if ($half_rows == $total_rows)
1452 0 0 if ($$new_page{'right_brother'} != 4294967295)
1465 0 0 if (defined $$self{'lefts'})
1469 0 0 if (defined $q and defined $$indexfile{'pages_cache'}{$q})
1477 0 0 if ($self_num == $$indexfile{'start_page'}) { }
1499 0 0 unless $parent = $self->get_parent_page
1505 0 0 if $$parent{'lefts'}[$i] == $self_num
1509 0 0 if ($i > $maxindex)
1538 0 0 unless my $parent = $self->get_parent_page
1545 0 0 if $$parent{'lefts'}[$i] == $self_num
1549 0 0 if ($i > $maxindex)
1555 0 0 if ($$parent{'values'}[$i] != $$self{'values'}[-1])
1566 0 5 if $XBase::cdx::Page::DEBUG
1572 0 0 if defined $$self{'parent'}
1576 0 0 if $$self{'num'} == $$indexfile{'start_page'}
1586 0 0 if ("$self" eq "$$indexfile{'pages'}[$pageindex]")
1596 0 0 unless my $parent_num = $self->get_parent_page_num