3 # $RCSfile: dbm.t,v $$Revision: 4.0.1.1 $$Date: 92/06/08 15:43:02 $
5 if (!-r '/usr/include/dbm.h' && !-r '/usr/include/ndbm.h'
6 && !-r '/usr/include/rpcsvc/dbm.h') {
15 print (dbmopen(h,'Op.dbmx',0640) ? "ok 1\n" : "not ok 1\n");
16 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
17 $blksize,$blocks) = stat('Op.dbmx.pag');
18 print (($mode & 0777) == 0640 ? "ok 2\n" : "not ok 2\n");
19 while (($key,$value) = each(h)) {
22 print (!$i ? "ok 3\n" : "not ok 3\n");
24 $h{'goner1'} = 'snork';
28 $h{'jkl','mno'} = "JKL\034MNO";
29 $h{'a',2,3,4,5} = join("\034",'A',2,3,4,5);
40 $h{'goner2'} = 'snork';
44 print (dbmopen(h,'Op.dbmx',0640) ? "ok 4\n" : "not ok 4\n");
64 $h{'goner3'} = 'snork';
72 if ($#keys == 29 && $#values == 29) {print "ok 5\n";} else {print "not ok 5\n";}
74 while (($key,$value) = each(h)) {
75 if ($key eq $keys[$i] && $value eq $values[$i] && $key gt $value) {
77 $i++ if $key eq $value;
81 if ($i == 30) {print "ok 6\n";} else {print "not ok 6\n";}
83 @keys = ('blurfl', keys(h), 'dyick');
84 if ($#keys == 31) {print "ok 7\n";} else {print "not ok 7\n";}
89 # check cache overflow and numeric keys and contents
91 for ($i = 1; $i < 200; $i++) { $h{$i + 0} = $i + 0; }
92 for ($i = 1; $i < 200; $i++) { $ok = 0 unless $h{$i} == $i; }
93 print ($ok ? "ok 8\n" : "not ok 8\n");
95 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
96 $blksize,$blocks) = stat('Op.dbmx.pag');
97 print ($size > 0 ? "ok 9\n" : "not ok 9\n");
99 @h{0..200} = 200..400;
101 print join(':',200..400) eq join(':',@foo) ? "ok 10\n" : "not ok 10\n";
103 print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n");
104 print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n");
106 unlink 'Op.dbmx.dir', 'Op.dbmx.pag';