+void tst_forward(ISAMB isb, int n)
+{
+ ISAMC_I isamc_i;
+ ISAMC_P isamc_p;
+ struct read_info ri;
+ int i;
+ ISAMB_PP pp;
+ char key_buf[10];
+
+ /* insert a number of entries */
+ ri.no = 0;
+ ri.max = n;
+
+ isamc_i.clientData = &ri;
+ isamc_i.read_item = code_read;
+
+ isamc_p = isamb_merge (isb, 0 /* new list */ , &isamc_i);
+
+ /* read the entries */
+ pp = isamb_pp_open (isb, isamc_p);
+
+ for (i = 0; i<ri.max; i++)
+ {
+ int x = -1;
+ int xu = i;
+ isamb_pp_forward(pp, &x, &xu);
+ if (x != xu)
+ {
+ yaz_log(LOG_WARN, "isamb_pp_forward (1). Got %d (expected %d)",
+ x, xu);
+ exit(4);
+ }
+ ri.no++;
+ }
+ isamb_pp_close(pp);
+
+ pp = isamb_pp_open (isb, isamc_p);
+ for (i = 0; i<ri.max; i += 100)
+ {
+ int x = -1;
+ int xuntil = i;
+ isamb_pp_forward(pp, &x, &xuntil);
+ if (x != xuntil)
+ {
+ yaz_log(LOG_WARN, "isamb_pp_forward (2). Got %d (expected %d)",
+ x, xuntil);
+ exit(4);
+ }
+ ri.no++;
+ }
+ isamb_pp_close(pp);
+
+ isamb_unlink(isb, isamc_p);
+}
+