From: rkinyon Date: Tue, 30 Jan 2007 05:25:55 +0000 (+0000) Subject: Added failing test for large numbers of transactions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2bc230aacd81d7518f8d0ae360e752e06026462;p=dbsrgits%2FDBM-Deep.git Added failing test for large numbers of transactions --- diff --git a/MANIFEST b/MANIFEST index bbc9e25..3c4d1b2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -54,4 +54,5 @@ t/39_singletons.t t/40_freespace.t t/41_transaction_multilevel.t t/42_transaction_indexsector.t +t/43_transaction_maximum.t t/common.pm diff --git a/t/43_transaction_maximum.t b/t/43_transaction_maximum.t new file mode 100644 index 0000000..95aba68 --- /dev/null +++ b/t/43_transaction_maximum.t @@ -0,0 +1,38 @@ +use strict; +use Test::More; +use Test::Deep; +use Test::Exception; +use t::common qw( new_fh ); + +use DBM::Deep; + +my $max_txns = 255; + +my ($fh, $filename) = new_fh(); + +my @dbs = grep { $_ } map { + eval { + DBM::Deep->new( + file => $filename, + num_txns => $max_txns, + ); + }; +} 1 .. $max_txns; + +my $num = $#dbs; + +plan tests => do { + my $n = $num + 1; + 2 * $n; +}; + +my %trans_ids; +for my $n (0 .. $num) { + lives_ok { + $dbs[$n]->begin_work + } "DB $n can begin_work"; + + my $trans_id = $dbs[$n]->_engine->trans_id, $/; + ok( !exists $trans_ids{ $trans_id }, "DB $n has a unique transaction ID" ); + $trans_ids{ $trans_id } = $n; +}