source: git/Tst/Short/dbm_s.tst @ 1427f62

fieker-DuValspielwiese
Last change on this file since 1427f62 was 75f460, checked in by Hans Schoenemann <hannes@…>, 9 years ago
format
  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[b35b93]1LIB "tst.lib";
2
3tst_init();
4
5"==============================================";
6" DBM link tests ";
7
8proc read_dbm_all (link l)
9{
10  string s="";
11  s=read(l);
[75f460]12  while( s != "" )
[b35b93]13  {
14    s,"=",read(l,s);
15    s=read(l);
16  }
17}
18proc read_dbm (link l)
19{
20  string s="";
21  s=read(l);
22  if( s != "" ) { s,"=",read(l,s); }
23}
24
25link l1="DBM:rw db1";
26link l2="DBM:rw db2";
27l1;
28
29int i;
30
31for(i=1;i<=5; i++)
32{
33  write(l1,"Key"+string(i), "Value"+string(i));
34  write(l2,"Key"+string(i), "DB 2 : Value"+string(i));
35}
36read_dbm(l1);
37read_dbm(l1);
38read_dbm(l2);
39read_dbm(l1);
40"**********************************************";
41read_dbm_all(l2);
42"**********************************************";
43read_dbm_all(l1);
44"**********************************************";
45write(l1,"Key4", "NewValue4");
46read(l1,"Key4");
47write(l1,"Key2");
48read(l1,"Key2");
[2a8e21]49//l2="DBM:r db2";
50//write(l2,"Key4"); // should fail
[b35b93]51l1="DBM: db1";
[68d66b]52write(l1,"Key4"); // should not fail
[b35b93]53close(l1);
54close(l2);
[2a8e21]55kill l1;
56kill l2;
[b35b93]57"**********************************************";
58string s="12345678901234567890123456789012345678901234567890";
59string t500=s+s+s+s+s+s+s+s+s+s;
60string t1k=t500+t500;
61link l="DBM:rw test";
62write(l,"a2",s);
63read(l,"a2");
64write(l,"a1",t1k);
65read(l,"a2");
66read(l,"a1");
67i=system("sh", "/bin/rm -f db1.dir db1.pag db2.dir db2.pag");
68i=system("sh", "/bin/rm -f test.dir test.pag");
69
[46976a6]70tst_status(1);$
Note: See TracBrowser for help on using the repository browser.