summaryrefslogtreecommitdiff
path: root/atarist/test/gdbm
blob: 207eea39a16c2edc6b10e8d8ca16bc268efb9a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
die "cant create dbmtest" unless dbmopen(%keys, "dbmtest", 0666);

print "Writing...\n";

foreach (0..100) {
    $keys{"$_"} = $_;
}

print "Done\n";

dbmclose (%keys);

die "cant read dbmtest" unless dbmopen(%rkeys, "dbmtest", undef);

$i = 0;
print "Reading...\n";
while (($key, $val) = each %rkeys)
{
  if ($keys{$key} != $val)
  {
     print 'Incorrect val ', $key, ' = ', $val, ' expecting ', $keys{$key}, "\n";
     $i = $i + 1;
  }
}
print "Done\n";
dbmclose (%keys);
print $i, " Error(s)\n";
unlink "dbmtest";