From: rkinyon Date: Sat, 22 Apr 2006 14:16:51 +0000 (+0000) Subject: Added tests for clear() and keys()/length() in the big hash/array tests X-Git-Tag: 0-99_01~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bee3661a8fbea0faab9396b22d4c56b759ef4198;p=dbsrgits%2FDBM-Deep.git Added tests for clear() and keys()/length() in the big hash/array tests --- diff --git a/t/03_bighash.t b/t/03_bighash.t index 091de54..b7d46f7 100644 --- a/t/03_bighash.t +++ b/t/03_bighash.t @@ -2,7 +2,7 @@ # DBM::Deep Test ## use strict; -use Test::More tests => 2; +use Test::More tests => 4; use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); @@ -30,3 +30,7 @@ for ( 0 .. $max_keys ) { }; } is( $count, $max_keys, "We read $count keys" ); + +cmp_ok( scalar(keys %$db), '==', $max_keys + 1, "Number of keys is correct" ); +$db->clear; +cmp_ok( scalar(keys %$db), '==', 0, "Number of keys after clear() is correct" ); diff --git a/t/05_bigarray.t b/t/05_bigarray.t index 8378c35..93a3db9 100644 --- a/t/05_bigarray.t +++ b/t/05_bigarray.t @@ -2,7 +2,7 @@ # DBM::Deep Test ## use strict; -use Test::More tests => 2; +use Test::More tests => 4; use t::common qw( new_fh ); use_ok( 'DBM::Deep' ); @@ -30,3 +30,7 @@ for ( 0 .. $max_keys ) { }; } 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" );