From: rkinyon Date: Mon, 15 Jan 2007 06:14:42 +0000 (+0000) Subject: Improved coverage by commenting out unused subs and adding some tests (one of which... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7701c066089eb423a09d4a5afba18fd541eb643a;p=dbsrgits%2FDBM-Deep.git Improved coverage by commenting out unused subs and adding some tests (one of which showcased a broken function --- diff --git a/lib/DBM/Deep.pm b/lib/DBM/Deep.pm index d93d268..51f8e82 100644 --- a/lib/DBM/Deep.pm +++ b/lib/DBM/Deep.pm @@ -1547,12 +1547,12 @@ B report on this distribution's test suite. ---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ - blib/lib/DBM/Deep.pm 87.7 81.0 81.0 93.9 89.5 4.2 87.2 - blib/lib/DBM/Deep/Array.pm 95.9 88.3 100.0 96.4 100.0 4.9 94.5 - blib/lib/DBM/Deep/Engine.pm 94.3 83.9 78.0 94.6 0.0 60.0 87.9 - blib/lib/DBM/Deep/File.pm 88.5 76.2 45.5 93.8 0.0 28.9 78.8 - blib/lib/DBM/Deep/Hash.pm 98.5 83.3 100.0 100.0 100.0 2.1 96.3 - Total 93.0 83.4 77.5 95.0 31.6 100.0 88.3 + blib/lib/DBM/Deep.pm 88.1 81.0 81.0 97.9 89.5 4.7 87.9 + blib/lib/DBM/Deep/Array.pm 99.5 90.0 100.0 100.0 100.0 5.8 97.6 + blib/lib/DBM/Deep/Engine.pm 95.6 84.6 78.0 99.1 0.0 58.8 89.3 + blib/lib/DBM/Deep/File.pm 92.6 80.0 45.5 100.0 0.0 28.8 82.6 + blib/lib/DBM/Deep/Hash.pm 98.5 83.3 100.0 100.0 100.0 2.0 96.3 + Total 94.7 84.4 77.5 99.1 32.1 100.0 89.9 ---------------------------- ------ ------ ------ ------ ------ ------ ------ =head1 MORE INFORMATION diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index d315aab..c5dcaa6 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -915,8 +915,8 @@ sub new { $self->_init; return $self; } -sub _init {} -sub clone { die "Must be implemented in the child class" } +#sub _init {} +#sub clone { die "Must be implemented in the child class" } sub engine { $_[0]{engine} } sub offset { $_[0]{offset} } @@ -1800,7 +1800,7 @@ sub free { my $e = $self->engine; for my $i ( 0 .. $e->hash_chars - 1 ) { - my $l = $self->location_for( $i ) or next; + my $l = $self->get_entry( $i ) or next; $e->_load_sector( $l )->free; } diff --git a/t/03_bighash.t b/t/03_bighash.t index af54164..a83ebcb 100644 --- a/t/03_bighash.t +++ b/t/03_bighash.t @@ -22,31 +22,31 @@ my $db = DBM::Deep->new( type => DBM::Deep->TYPE_HASH, ); +$db->{foo} = {}; +my $foo = $db->{foo}; + ## # put/get many keys ## my $max_keys = 4000; for ( 0 .. $max_keys ) { - $db->put( "hello $_" => "there " . $_ * 2 ); + $foo->put( "hello $_" => "there " . $_ * 2 ); } my $count = -1; for ( 0 .. $max_keys ) { $count = $_; - unless ( $db->get( "hello $_" ) eq "there " . $_ * 2 ) { + unless ( $foo->get( "hello $_" ) eq "there " . $_ * 2 ) { last; }; } is( $count, $max_keys, "We read $count keys" ); -#SKIP: { -#skip "Keys aren't ready yet", 3; -my @keys = sort keys %$db; +my @keys = sort keys %$foo; cmp_ok( scalar(@keys), '==', $max_keys + 1, "Number of keys is correct" ); my @control = sort map { "hello $_" } 0 .. $max_keys; cmp_deeply( \@keys, \@control, "Correct keys are there" ); $db->clear; cmp_ok( scalar(keys %$db), '==', 0, "Number of keys after clear() is correct" ); -#}