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
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
START_MARKER 
 
// gdbm 
cond_begin([[ master()->resolv("Gdbm") ]]) 
 
  test_true(programp(Gdbm.gdbm)) 
 
  define([[GDBMTESTS]], 
  [[ 
    test_do(rm("test.gdbm")) 
    test_do(add_constant("GDBMBASE",Gdbm.gdbm("test.gdbm"))) 
    test_true(file_stat("test.gdbm")) 
 
    GDBMNULLTEST 
    test_true(GDBMBASE->store("foo","bar")) 
    GDBMNULLTEST 
    test_equal(GDBMBASE->fetch("foo"),"bar") 
    test_do([[int e; for(e=0;e<100;e++) GDBMBASE->store("x"+e,"y"+e)]]) 
    GDBMNULLTEST 
    test_any(int e; for(e=0;e<100;e++) if(GDBMBASE->fetch("x"+e)!="y"+e) return e; return -1,-1) 
    GDBMNULLTEST 
    test_true(GDBMBASE->store(sprintf("%'23'100000s","") , sprintf("%'32'100000s",""))) 
    test_true(GDBMBASE->fetch(sprintf("%'23'100000s",""))==sprintf("%'32'100000s","")) 
    GDBMNULLTEST 
    test_equal(GDBMBASE->fetch("foo"),"bar") 
    test_any(int e; for(e=0;e<100;e++) if(GDBMBASE->fetch("x"+e)!="y"+e) return e; return -1,-1) 
    test_true(GDBMBASE->fetch(sprintf("%'23'100000s",""))==sprintf("%'32'100000s","")) 
    test_any(int e; string k; for(k=GDBMBASE->firstkey();k;k=GDBMBASE->nextkey(k)) e++; return e,102) 
 
    test_do(GDBMBASE->sync()) 
    test_do(GDBMBASE->reorganize()) 
    test_do(GDBMBASE->close()) 
  ]]) 
 
  define([[GDBMNULLTEST]],[[ 
    test_false(GDBMBASE->fetch("slakjdfasdf")) 
  ]]) 
 
  GDBMTESTS 
 
  define([[GDBMNULLTEST]],[[ 
    test_false(GDBMBASE->fetch("slakjdfasdf")) 
    test_do(GDBMBASE->reorganize()) 
    test_do(GDBMBASE->sync()) 
    test_do(GDBMBASE->close()) 
    test_do(add_constant("GDBMBASE",Gdbm.gdbm("test.gdbm"))) 
  ]]) 
 
  GDBMTESTS 
 
  test_do(rm("test.gdbm")) 
  test_do(add_constant("GDBMBASE")) 
 
cond_end // Gdbm 
 
END_MARKER