Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CDB_File.xs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ static int cdb_findnext(cdb *c, string_finder *to_find) {
case -1:
return -1;
case 0:
return 0;
continue;
default:
uint32_unpack(buf + 4,&c->dlen);
c->dpos = pos + 8 + next_key_len;
Expand Down
31 changes: 31 additions & 0 deletions t/collision.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/lib";
use Helpers; # Local helper routines used by the test suite.

use Test::More tests => 8;
use CDB_File;

my @keys = qw/Q5M QCX QK3 TPM QN5/;

my ( $db, $db_tmp ) = get_db_file_pair(1);

my $c = CDB_File->new( $db->filename, $db_tmp->filename );
isa_ok( $c, 'CDB_File::Maker' );

for my $k (@keys) {
$c->insert($k, 1);
};
is( $c->finish, 1, "Finish writes out" );

my %h;
tie( %h, "CDB_File", $db->filename );
isa_ok( tied(%h), 'CDB_File' );

for my $k (sort @keys) {
is( $h{$k}, 1, "$k matches" );
}

exit;