use Test::More tests => 189;
BEGIN { use_ok('DBM_Filter') };
-BEGIN { use_ok('SDBM_File') };
+my $db_file;
+BEGIN {
+ use Config;
+ foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
+ if ($Config{extensions} =~ /\b$_\b/) {
+ $db_file = $_;
+ last;
+ }
+ }
+ use_ok($db_file);
+};
BEGIN { use_ok('Fcntl') };
unlink <Op_dbmx*>;
my %h;
# read the dbm file without the filter
- ok tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640), "tied to SDBM_File";
+ ok tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640), "tied to $db_file";
my %bad = ();
while (my ($k, $v) = each %h) {
#diag "Test Set: Key and Value Filter, no stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Key Only Filter, no stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Value Only Filter, no stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Key and Value Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Key Filter != Value Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Key only Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Value only Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Combination Key/Value + Key Filter != Value Filter, with stacking, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Combination Key/Value + Key + Key/Value, no closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Combination Key/Value + Key + Key/Value, with closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Combination Key/Value + Key + Key/Value, immediate";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Combination Key/Value + Key + Key/Value, immediate, closure";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
#diag "Test Set: Filtered & Filter_Pop";
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);
}
my %h = () ;
- my $db = tie(%h, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
- ok $db, "tied to SDBM_File";
+ my $db = tie(%h, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
+ ok $db, "tied to $db_file";
doPreData(\%h);