source: git/Tst/Short/dbm_s.tst @ 0054e7

spielwiese
Last change on this file since 0054e7 was ef52d6, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Update testsuite wrt current master (320c4f5e64cad778b4ada9556a9b0a6c71cab83a) NOTE: some wrong/bad tests were removed... TODO: add the reset of these updates after updating LIB/
  • Property mode set to 100644
File size: 1.3 KB
Line 
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);
12  while( s != "" )
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");
49//l2="DBM:r db2";
50//write(l2,"Key4"); // should fail
51l1="DBM: db1";
52write(l1,"Key4"); // should not fail
53close(l1);
54close(l2);
55kill l1;
56kill l2;
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
70tst_status(1);$
Note: See TracBrowser for help on using the repository browser.