/[webpac]/trunk/openisis/lstbtest.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/openisis/lstbtest.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 239 - (show annotations)
Mon Mar 8 17:49:13 2004 UTC (16 years, 8 months ago) by dpavlin
File MIME type: text/plain
File size: 17091 byte(s)
including openisis 0.9.0 into webpac tree

1 /*
2 openisis - an open implementation of the CDS/ISIS database
3 Version 0.8.x (patchlevel see file Version)
4 Copyright (C) 2001-2003 by Erik Grziwotz, erik@openisis.org
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 see README for more information
21 EOH */
22
23 /*
24 $Id: lstbtest.c,v 1.23 2003/06/30 09:52:03 kripke Exp $
25 tests for lstb methods.
26 */
27
28 #include <errno.h>
29 #include <stdarg.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <unistd.h> /* unlink */
34
35 #include "openisis.h"
36 #include "loi.h"
37 #include "ldb.h" /* ldb_getdb */
38 #include "luti.h" /* luti_unwrap */
39
40 static int _RspCld[1] = { 0 };
41 static int _DelCld[1] = { 0 };
42
43 static OpenIsisStubCbData cbdta;
44 static Stub st0, st1, st2, st3;
45 static Schema *sc0, *sc1, *sc2, *sc3;
46 static Db *db;
47 static Rec *rqs, *rsp;
48 static char *args[64];
49 static int alen;
50
51
52 /* ************************************************************
53 utils
54 */
55
56 static void _lstb_assert (int cond, const char *where, char *fmt, ...) {
57 if (! cond) {
58 va_list ap;
59 va_start (ap, fmt);
60 fprintf (stderr, "ERR %s: ", where ? where : "");
61 vfprintf (stderr, fmt, ap);
62 fprintf (stderr, "\n");
63 va_end (ap);
64 exit (1);
65 }
66 }
67
68 static int _rsp_cb (void *cld, Stub stb, Rec *rsprec, Db *x) {
69 (void)stb; (void)rsprec; (void)x;
70 if (cld) {
71 ++(*((int*)cld));
72 }
73 return 0;
74 }
75
76 static void _del_cb (void *cld, Stub stb, void *cbd) {
77 (void)stb;
78 ++(*((int*)cld));
79 if (cbd) {
80 _lstb_assert (cbd == (void*)_RspCld, "DELCB",
81 "%d: %p != %p", *((int*)cld), cbd, _RspCld);
82 --(*((int*)cbd));
83 }
84 }
85
86 static void _cmp_rec (const char *msg, Rec *r1, Rec *r2) {
87 char buf1[32], buf2[32];
88 Field *f1, *f2;
89 int j;
90 _lstb_assert (0 != r1, msg, "chkr: r1 == 0");
91 _lstb_assert (0 != r2, msg, "chkr: r2 == 0");
92 _lstb_assert (r1->len == r2->len, msg, "chkr: reclen = %d/%d",
93 r1->len, r2->len);
94 buf1[31] = buf2[31] = 0;
95 for (f1 = r1->field, f2 = r2->field, j = 0;
96 r1->len > j;
97 ++f1, ++f2, ++j) {
98 _lstb_assert (f1->tag == f2->tag, msg, "chkr: tag[%d] = %d/%d",
99 j, f1->tag, f2->tag);
100 _lstb_assert (f1->len == f2->len, msg, "chkr: len[%d] = %d/%d",
101 j, f1->len, f2->len);
102 strncpy (buf1, f1->val, 31 < f1->len ? 31 : f1->len);
103 strncpy (buf2, f2->val, 31 < f1->len ? 31 : f1->len);
104 _lstb_assert (0 == memcmp (f1->val, f2->val, f1->len), msg,
105 "field[%d] = %s/%s", j, buf1, buf2);
106 }
107 }
108
109 static void _chk_rec (const char *msg, Rec *rec, int dbid, int rowid) {
110 Rec *r2 = dRead (dbid, rowid);
111 _cmp_rec (msg, rec, r2);
112 mFree (r2);
113 }
114
115 static Rec* _buildrqs (int argc, char **argv) {
116 return rSet (0, RARGV | RFDT | argc, openIsisFdtRqs, argv);
117 }
118
119 static int _set_tms (const char *msg, char *dbn, int delta) {
120 static char tbuf[32];
121 int j;
122
123 _lstb_assert (0 != sc0, msg, "(tms) sc0 == 0");
124 _lstb_assert (0 < sc0->ndbs, msg, "(tms) sc0->ndbs = %d", sc0->ndbs);
125 for (j = 0, db = 0; sc0->ndbs > j; ++j) {
126 if (0 == strcmp (sc0->dbs[j]->name, dbn)) {
127 db = sc0->dbs[j];
128 break;
129 }
130 }
131 _lstb_assert (0 != db, msg, "(tms) no such db: %s", dbn);
132 _lstb_assert (0 != db->tms, msg, "(tms) tms == 0");
133
134 sprintf (tbuf, "%d", (db->tms + delta));
135 args[alen++] = "tms";
136 args[alen++] = tbuf;
137
138 return db->tms;
139 }
140
141 /* ************************************************************
142 tests
143 */
144
145 static void _open_srv (const char *msg, int argc, const char **argv) {
146 const char *scargs[] = {
147 "host", "tonno", "port", "4242"
148 };
149 int scnum = sizeof (scargs) / sizeof (scargs[0]);
150
151 st0 = openIsisNInit (argc, argv, &cbdta);
152 _lstb_assert (0 != st0, msg, "st0 == 0");
153 sc0 = openIsisNSchema (st0);
154 _lstb_assert (0 != sc0, msg, "sc0 == 0");
155 _lstb_assert (0 == sc0->scid, msg, "sc0.scid = %x", sc0->scid);
156
157 st1 = openIsisNOpen ("nonno", scnum, scargs, &cbdta);
158 _lstb_assert (0 != st1, msg, "st1 == 0");
159 _lstb_assert (st0 != st1, msg, "st1 == st0");
160 sc1 = openIsisNSchema (st1);
161 _lstb_assert (0 != sc1, msg, "sc1 == 0");
162 _lstb_assert (0x0100 == sc1->scid, msg, "sc1.scid = %x", sc1->scid);
163
164 st2 = openIsisNInit (0, 0, 0);
165 _lstb_assert (st2 == st0, msg, "st2 %p != %p", st2, st0);
166 sc2 = openIsisNSchema (st2);
167 _lstb_assert (sc2 == sc0, msg, "sc2 %p != %p", sc2, sc0);
168
169 st3 = openIsisNOpen ("nonno", 0, 0, 0);
170 _lstb_assert (st3 == st1, msg, "st3 %p != %p", st3, st1);
171 sc3 = openIsisNSchema (st1);
172 _lstb_assert (sc3 == sc1, msg, "sc3 %p != %p", sc3, sc1);
173 }
174
175 static void _open_db (const char *msg, char *dbn) {
176 int rt;
177
178 alen = 0;
179 args[alen++] = "type";
180 args[alen++] = "open";
181 args[alen++] = "db";
182 args[alen++] = dbn;
183 rqs = _buildrqs (alen, args);
184 _lstb_assert (0 != rqs, msg, "rqs == 0");
185 rt = openIsisNSend (st0, rqs, &_rsp_cb, _RspCld, 0);
186 _lstb_assert (0 == rt, msg, "rt = %d", rt);
187
188 rsp = openIsisNRecv (st0, 0);
189 _lstb_assert (0 != rsp, msg, "rsp == 0");
190 rt = rInt (rsp, OPENISIS_RSP_ERR, -1, 0);
191 _lstb_assert (0 == rt, msg, "err = %d", rt);
192
193 db = ldb_getdb (0);
194 _lstb_assert (0 != db, msg, "db == 0");
195 _lstb_assert (0 == strcmp (db->name, "cds"), msg, "db0: %s", db->name);
196 }
197
198 static void _close_db (const char *msg, char *dbn, int dbid) {
199 int rt;
200
201 alen = 0;
202 args[alen++] = "type";
203 args[alen++] = "close";
204 args[alen++] = "db";
205 args[alen++] = dbn;
206 rqs = _buildrqs (alen, args);
207 _lstb_assert (0 != rqs, msg, "rqs == 0");
208 rt = openIsisNSend (st0, rqs, &_rsp_cb, _RspCld, 0);
209 _lstb_assert (0 == rt, msg, "rt = %d", rt);
210
211 rsp = openIsisNRecv (st0, 0);
212 _lstb_assert (0 != rsp, msg, "rsp == 0");
213 rt = rInt (rsp, OPENISIS_RSP_ERR, -1, 0);
214 _lstb_assert (0 == rt, msg, "err = %d", rt);
215
216 if (0 <= dbid) {
217 db = ldb_getdb (dbid);
218 _lstb_assert (0 == db, msg, "db != 0");
219 }
220 }
221
222 static void _lsdb (const char *msg) {
223 char dbn[OPENISIS_DB_NAMELEN];
224 char *n1;
225 int rt, pos;
226
227 alen = 0;
228 args[alen++] = "type";
229 args[alen++] = "ls";
230 rqs = _buildrqs (alen, args);
231 _lstb_assert (0 != rqs, msg, "rqs == 0");
232 rt = openIsisNSend (st0, rqs, 0, 0, 0);
233 _lstb_assert (0 == rt, msg, "rt = %d", rt);
234
235 rsp = openIsisNRecv (st0, 0);
236 _lstb_assert (0 != rsp, msg, "rsp == 0");
237
238 pos = 0;
239 n1 = rString (rsp, OPENISIS_COM_DBN, &pos, dbn, OPENISIS_DB_NAMELEN);
240 _lstb_assert (0 != n1, msg, "db(0) == 0");
241 _lstb_assert (0 == strcmp (n1, "cds"), msg, "db(0) = %s", n1);
242 n1 = rString (rsp, OPENISIS_COM_DBN, &pos, dbn, OPENISIS_DB_NAMELEN);
243 _lstb_assert (0 != n1, msg, "db(1) == 0");
244 _lstb_assert (0 == strcmp (n1, "lstbtest"), msg, "db(1) = %s", n1);
245 n1 = rString (rsp, OPENISIS_COM_DBN, &pos, dbn, OPENISIS_DB_NAMELEN);
246 _lstb_assert (0 == n1, msg, "db(2) = %s", n1);
247 }
248
249 static void _maxrow (const char *msg, char *dbn, int exp) {
250 int rt;
251
252 alen = 0;
253 args[alen++] = "type";
254 args[alen++] = "maxrow";
255 args[alen++] = "db";
256 args[alen++] = dbn;
257 rqs = _buildrqs (alen, args);
258 _lstb_assert (0 != rqs, msg, "rqs == 0");
259 rt = openIsisNSend (st0, rqs, &_rsp_cb, _RspCld, 0);
260 _lstb_assert (0 == rt, msg, "rt = %d", rt);
261
262 rsp = openIsisNRecv (st0, 0);
263 _lstb_assert (0 != rsp, msg, "rsp == 0");
264 rt = rInt (rsp, OPENISIS_RSP_ERR, -1, 0);
265 _lstb_assert (0 == rt, msg, "err = %d", rt);
266 rt = rInt (rsp, OPENISIS_RSP_NUMT, -1, 0);
267 _lstb_assert (-1 == rt, msg, "numt = %d", rt);
268 rt = rInt (rsp, OPENISIS_COM_ROW, -1, 0);
269 if (0 <= exp) {
270 _lstb_assert (exp == rt, msg, "rowid = %d(%d)", rt, exp);
271 }
272 else {
273 _lstb_assert (0 <= rt, msg, "rowid = %d", rt);
274 }
275 }
276
277 static void _maxrowerr (const char *msg, char *dbn) {
278 int rt, tms;
279
280 alen = 0;
281 args[alen++] = "type";
282 args[alen++] = "maxrow";
283 args[alen++] = "db";
284 args[alen++] = dbn;
285 tms = _set_tms (msg, dbn, -2);
286 rqs = _buildrqs (alen, args);
287 _lstb_assert (0 != rqs, msg, "rqs == 0");
288 rt = openIsisNSend (st0, rqs, &_rsp_cb, _RspCld, 0);
289 _lstb_assert (0 == rt, msg, "rt = %d x%x", rt, rt);
290
291 rsp = openIsisNRecv (st0, 0);
292 _lstb_assert (0 != rsp, msg, "rsp == 0");
293 rt = rInt (rsp, OPENISIS_RSP_ERR, -1, 0);
294 _lstb_assert (ERR_INVAL == rt, msg, "err = %d", rt);
295 rt = rInt (rsp, OPENISIS_COM_TMS, -1, 0);
296 _lstb_assert (tms == rt, msg, "tms = %d(%d)", rt, tms);
297 }
298
299 static void _lstb_read (const char *msg, int rid, int rlen) { /* no _rsp_cb */
300 Rec *rec;
301 Db *rdb;
302 char rbuf[32];
303 int rt;
304
305 alen = 0;
306 args[alen++] = "type";
307 args[alen++] = "read";
308 args[alen++] = "db";
309 args[alen++] = "cds";
310 _set_tms (msg, "cds", 0);
311 sprintf (rbuf, "%d", rid);
312 args[alen++] = "rowid";
313 args[alen++] = rbuf;
314 rqs = _buildrqs (alen, args);
315 _lstb_assert (0 != rqs, msg, "rqs == 0");
316 rt = openIsisNSend (st0, rqs, 0, _RspCld, 0);
317 _lstb_assert (0 == rt, msg, "rt = %d", rt);
318
319 rsp = openIsisNRecv (st0, &rdb);
320 _lstb_assert (0 != rsp, msg, "rsp == 0");
321 _lstb_assert (0 != rdb, msg, "rdb == 0");
322 rt = rInt (rsp, OPENISIS_RSP_ERR, -1, 0);
323 _lstb_assert (0 == rt, msg, "err = %d", rt);
324 rt = rInt (rsp, OPENISIS_RSP_NUMT, -1, 0);
325 _lstb_assert (1 == rt, msg, "numt = %d", rt);
326 rt = rInt (rsp, OPENISIS_COM_ROW, -1, 0);
327 _lstb_assert (rid == rt, msg, "rowid = %d(%d)", rt, rid);
328
329 rec = luti_unwrap (rsp, 0, OPENISIS_COM_REC, rdb->dbid);
330 _lstb_assert (0 != rec, msg, "rec == 0");
331 if (0 < rlen) {
332 _lstb_assert (rlen == rec->len, msg, "rec->len = %d(%d)", rec->len, rlen);
333 }
334 else {
335 _lstb_assert (0 < rec->len, msg, "rec->len = %d", rec->len);
336 }
337 _lstb_assert (rdb->dbid == rec->dbid, msg,
338 "rec->dbid = %d(%d)", rec->dbid, rdb->dbid);
339
340 _chk_rec (msg, rec, 0, rid);
341 mFree (rec);
342 }
343
344 static int _query ( /* no _rsp_cb */
345 const char *msg, int flg, int mode, int skip, int size, int exp
346 ) {
347 Rec **recs;
348 Db *rdb;
349 char fbuf[32], mbuf[32], kbuf[32], sbuf[32];
350 int *rowids;
351 int rt, rr, j;
352
353 alen = 0;
354 args[alen++] = "type";
355 args[alen++] = "query";
356 args[alen++] = "db";
357 args[alen++] = "cds";
358 sprintf (mbuf, "%d", mode);
359 args[alen++] = "mode";
360 args[alen++] = mbuf;
361 if (flg) {
362 sprintf (fbuf, "%d", flg);
363 args[alen++] = "flags";
364 args[alen++] = fbuf;
365 }
366 if (skip) {
367 sprintf (kbuf, "%d", skip);
368 args[alen++] = "skip";
369 args[alen++] = kbuf;
370 }
371 if (size) {
372 sprintf (sbuf, "%d", size);
373 args[alen++] = "size";
374 args[alen++] = sbuf;
375 }
376 args[alen++] = "key";
377 args[alen++] = "Africa$";
378 rqs = _buildrqs (alen, args);
379 _lstb_assert (0 != rqs, msg, "rqs == 0");
380 rt = openIsisNSend (st0, rqs, 0, _RspCld, 0);
381 _lstb_assert (0 == rt, msg, "rt = %d", rt);
382
383 rsp = openIsisNRecv (st0, &rdb);
384 _lstb_assert (0 != rsp, msg, "rsp == 0");
385 _lstb_assert (0 != rdb, msg, "rdb == 0");
386 rt = rInt (rsp, OPENISIS_RSP_ERR, -1, 0);
387 _lstb_assert (0 == rt, msg, "err = %d", rt);
388
389 rr = openIsisNGetResult (st0, &rowids, &recs, 0, &rt);
390 if (0 <= exp) {
391 _lstb_assert (exp == rr, msg, "numr = %d(%d)", rr, exp);
392 }
393 else {
394 _lstb_assert (0 <= rr, msg, "numr = %d", rr);
395 }
396 _lstb_assert (rt >= rr, msg, "numt = %d/%d", rt, rr);
397
398 if (recs) {
399 for (j = 0; rr > j; ++j) {
400 _chk_rec (msg, recs[j], 0, rowids[j]);
401 mFree (recs[j]);
402 }
403 mFree (recs);
404 }
405
406 rt = rr ? rowids[rr - 1] : -1;
407 mFree (rowids);
408 return rt;
409 }
410
411 static int _update (const char *msg,
412 int rid, int rtag, char *rval, int itag, char *ival, int exp
413 ) {
414 Rec *rec;
415 char rbuf[32];
416 int rt;
417
418 alen = 0;
419 args[alen++] = "type";
420 args[alen++] = 0 <= rid ? "update" : "insert";
421 args[alen++] = "db";
422 args[alen++] = "lstbtest";
423 _set_tms (msg, "lstbtest", 0);
424 if (0 <= rid) {
425 sprintf (rbuf, "%d", rid);
426 args[alen++] = "rowid";
427 args[alen++] = rbuf;
428 }
429 rqs = _buildrqs (alen, args);
430 rec = rSet (0, 0, rtag, rval,
431 88, "summary of the conference in gondor", 0);
432 rqs = luti_wrap (rqs, rec, OPENISIS_COM_REC);
433 mFree (rec);
434 if (itag) {
435 rec = rSet (0, 0, itag, ival, 0);
436 rqs = luti_wrap (rqs, rec, OPENISIS_COM_REC);
437 mFree (rec);
438 }
439
440 rt = openIsisNSend (st0, rqs, &_rsp_cb, _RspCld, 0);
441 _lstb_assert (0 == rt, msg, "rt = %d", rt);
442
443 rsp = openIsisNRecv (st0, 0);
444 _lstb_assert (0 != rsp, msg, "rsp == 0");
445 rt = rInt (rsp, OPENISIS_RSP_ERR, -1, 0);
446 _lstb_assert (0 == rt, msg, "err = %d", rt);
447 rt = rInt (rsp, OPENISIS_COM_ROW, -1, 0);
448 if (0 < exp) {
449 _lstb_assert (exp == rt, msg, "rowid = %d(%d)", rt, exp);
450 }
451 else {
452 _lstb_assert (0 < rt, msg, "rowid = %d", rt);
453 }
454
455 return rt;
456 }
457
458 static void _rmtstdb () {
459 char *exts[] = { "oxi", "txt", "ptr" };
460 char path[1024];
461 char *p;
462 int err, j;
463 if (! sc0) {
464 fprintf (stderr, "rmtstdb: st0 == 0\n");
465 return;
466 }
467 if (! sc0->cfg) {
468 fprintf (stderr, "rmtstdb: st0->cfg == 0\n");
469 return;
470 }
471 if (! rString (sc0->cfg, OPENISIS_SPATH, 0, path, 990)) {
472 fprintf (stderr, "rmtstdb: path not given\n");
473 return;
474 }
475 p = path + strlen (path);
476 *p++ = '/';
477 if (rString (sc0->cfg, OPENISIS_DPATH, 0, p, 10)) {
478 p += strlen (p);
479 *p++ = '/';
480 }
481
482 err = 0;
483 strcpy (p, "lstbtest.");
484 p += 9;
485 for (j = sizeof (exts) / sizeof (exts[0]); 0 <= --j; ) {
486 strcpy (p, exts[j]);
487 errno = 0;
488 if (unlink (path)) {
489 fprintf (stderr, "rmtstdb: cannot unlink %s: errno = %d\n",
490 p - 9, errno);
491 err = !0;
492 }
493 }
494 if (! err) {
495 log_msg (LOG_INFO, "db lstbtest removed.");
496 }
497 }
498
499 static void _tstUnwrap () {
500 Rec *r1, *r2, *r31, *r32, *r4;
501 r31 = rSet (0, 0, 11, "r3111", 12, "r3112", 13, "r3113", 0);
502 r32 = rSet (0, 0, 11, "r3211", 12, "r3212", 13, "r3213", 0);
503 r2 = rSet (0, 0, 21, "r221", 22, "r222", 0);
504 r2 = luti_wrap (r2, r31, 89);
505 r2 = rSet (r2, 0, 23, "r223", 0);
506 r2 = luti_wrap (r2, r32, 89);
507 r1 = 0;
508 r1 = luti_wrap (r1, r2, 79);
509 r1 = rSet (r1, 0, 111, "r1111", 112, "r1112", 0);
510 r4 = luti_getembed (r1, ".79.89[1]", 0);
511 _cmp_rec ("unwrap", r4, r32);
512 mFree (r1);
513 mFree (r2);
514 mFree (r31);
515 mFree (r32);
516 mFree (r4);
517 }
518
519 int main (int argc, char **argv) {
520 char *argd[64];
521 int lastid, lvl, j;
522
523 lvl = LOG_ERROR;
524 switch (argc) {
525 case 2:
526 j = atoi (argv[1]);
527 goto dfltargs;
528 case 0:
529 case 1:
530 j = 1;
531 dfltargs:
532 argc = 0;
533 argd[argc++] = "syspath";
534 argd[argc++] = "/opt/openisis/db";
535 argd[argc++] = "dbpath";
536 argd[argc++] = "cds";
537 argv = argd;
538 break;
539 default:
540 if ((j = atoi (argv[1]))) {
541 --argc;
542 ++argv;
543 if (0 < (lastid = atoi (argv[2]))) {
544 lvl = lastid;
545 --argc;
546 ++argv;
547 }
548 }
549 else {
550 j = 1;
551 }
552 --argc;
553 ++argv;
554 }
555
556 cLog (lvl, 0);
557
558 do {
559 _RspCld[0] = _DelCld[0] = 0;
560 st0 = st1 = st2 = st3 = 0;
561 sc0 = sc1 = sc2 = sc3 = 0;
562 db = 0;
563 rqs = rsp = 0;
564
565 openIsisNInit (0, 0, 0);
566 openIsisNDeinit ();
567
568 memset (&cbdta, 0, sizeof (OpenIsisStubCbData));
569 cbdta.delcb = &_del_cb;
570 cbdta.delcld = _DelCld;
571
572 _open_srv ("A", argc, (const char**)argv);
573
574 openIsisNDeinit ();
575 _lstb_assert (0 == stub0, "B", "stub0 != 0");
576 _lstb_assert (2 == _DelCld[0], "B", "_DelCld = %d", _DelCld[0]);
577 sc1 = openIsisNSchema (st1);
578 _lstb_assert (sc1 == 0, "B", "sc1 != 0");
579
580 _open_srv ("C", argc, (const char**)argv);
581
582 openIsisNClose (st3);
583 _lstb_assert (3 == _DelCld[0], "D", "_DelCld = %d", _DelCld[0]);
584 sc1 = openIsisNSchema (st1);
585 _lstb_assert (sc1 == 0, "D", "sc1 != 0");
586
587 _open_db ("E", "cds");
588 _close_db ("F", "cds", 0);
589 _open_db ("G", "cds");
590 _close_db ("H", "cds", 0);
591 _open_db ("I", "cds");
592 _lstb_assert (0 == _RspCld[0], "I", "_RspCld = %d", _RspCld[0]);
593 _lstb_assert (8 == _DelCld[0], "I", "_DelCld = %d", _DelCld[0]);
594
595 _maxrow ("J", "cds", 151);
596 _lstb_read ("K", 94, 7);
597 _lstb_assert (0 == _RspCld[0], "K", "_RspCld = %d", _RspCld[0]);
598 _lstb_assert (9 == _DelCld[0], "K", "_DelCld = %d", _DelCld[0]);
599
600 _query ("L", 0, OPENISIS_QRY_KEYAT, 0, 0, 5);
601 lastid = _query ("M", 0, OPENISIS_QRY_KEYAT, 0, 4, 4);
602 _query ("N", 0, OPENISIS_QRY_KEYAT, 1 + lastid, 4, 1);
603 _query ("P", OPENISIS_RQSF_QRR, OPENISIS_QRY_KEYAT, 0, 0, 5);
604 lastid = _query ("Q", OPENISIS_RQSF_QRR, OPENISIS_QRY_KEYAT, 0, 4, 4);
605 _query ("R", OPENISIS_RQSF_QRR, OPENISIS_QRY_KEYAT, 1 + lastid, 4, 1);
606 _lstb_assert (0 == _RspCld[0], "R", "_RspCld = %d", _RspCld[0]);
607 _lstb_assert (9 == _DelCld[0], "R", "_DelCld = %d", _DelCld[0]);
608
609 _open_db ("S", "lstbtest");
610 lastid = _update ("T", -1, 22, "Gandalf", 22, "Frodo", 1);
611 _update ("U", -1, 23, "Larry", 0, 0, 2);
612 _update ("V", lastid, 22, "Harry", 0, 0, 1);
613 _maxrow ("W", "lstbtest", 2);
614
615 _lsdb ("X");
616
617 _close_db ("Y", "lstbtest", 1);
618 _lstb_assert (0 == _RspCld[0], "Y", "_RspCld = %d", _RspCld[0]);
619 _lstb_assert (15 == _DelCld[0], "Y", "_DelCld = %d", _DelCld[0]);
620 _rmtstdb ();
621
622 _maxrowerr ("Z", "cds");
623
624 _lstb_read ("a", 94, 7);
625 _maxrow ("b", "cds", 151);
626 _lstb_read ("c", 94, 7);
627
628 _tstUnwrap ();
629
630 openIsisNDeinit ();
631
632 _lstb_assert (0 == _RspCld[0], "z", "_RspCld = %d", _RspCld[0]);
633 _lstb_assert (18 == _DelCld[0], "z", "_DelCld = %d", _DelCld[0]);
634
635 if (0 == (j % 100)) {
636 printf ("%d ...\n", j);
637 }
638 } while (--j);
639
640 printf ("ok.\n");
641 return 0;
642 }
643

  ViewVC Help
Powered by ViewVC 1.1.26