From: rkinyon Date: Sun, 31 Dec 2006 20:10:11 +0000 (+0000) Subject: Test cleanup X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eda91e5d6d964f949c20badcdd016c7fe638f28e;p=dbsrgits%2FDBM-Deep.git Test cleanup --- diff --git a/t/05_bigarray.todo b/t/05_bigarray.todo deleted file mode 100644 index 81c5046..0000000 --- a/t/05_bigarray.todo +++ /dev/null @@ -1,43 +0,0 @@ -## -# DBM::Deep Test -## -use strict; -use Test::More; - -plan skip_all => "You must set \$ENV{LONG_TESTS} to run the long tests" - unless $ENV{LONG_TESTS}; - -plan tests => 4; -use t::common qw( new_fh ); - -use_ok( 'DBM::Deep' ); - -diag "This test can take up to a minute to run. Please be patient."; - -my ($fh, $filename) = new_fh(); -my $db = DBM::Deep->new( - file => $filename, - type => DBM::Deep->TYPE_ARRAY, -); - -## -# put/get many keys -## -my $max_keys = 4000; - -for ( 0 .. $max_keys ) { - $db->put( $_ => $_ * 2 ); -} - -my $count = -1; -for ( 0 .. $max_keys ) { - $count = $_; - unless ( $db->get( $_ ) == $_ * 2 ) { - last; - }; -} -is( $count, $max_keys, "We read $count keys" ); - -cmp_ok( scalar(@$db), '==', $max_keys + 1, "Number of elements is correct" ); -$db->clear; -cmp_ok( scalar(@$db), '==', 0, "Number of elements after clear() is correct" ); diff --git a/t/28_index_sector.t b/t/28_index_sector.t new file mode 100644 index 0000000..2efd704 --- /dev/null +++ b/t/28_index_sector.t @@ -0,0 +1,25 @@ +use strict; +use Test::More tests => 35; +use Test::Deep; +use t::common qw( new_fh ); + +use_ok( 'DBM::Deep' ); + +my ($fh, $filename) = new_fh(); +my $db = DBM::Deep->new( + file => $filename, + locking => 1, + autoflush => 1, +); + +for ( 1 .. 17 ) { + $db->{ $_ } = $_; + is( $db->{$_}, $_, "Addition of $_ is still $_" ); +} + +for ( 1 .. 17 ) { + is( $db->{$_}, $_, "Verification of $_ is still $_" ); +} + +my @keys = keys %$db; +cmp_ok( scalar(@keys), '==', 17, "Right number of keys returned" );