+static void tst(Dict dict, int start, int number)
+{
+ int i;
+
+ /* insert again with original value again */
+ for (i = start; i < number; i += 100)
+ {
+ int v = i;
+ char w[32];
+ sprintf(w, "%d", i);
+ YAZ_CHECK_EQ(dict_insert(dict, w, sizeof(v), &v), 2);
+ }
+ /* insert again with different value */
+ for (i = start; i < number; i += 100)
+ {
+ int v = i-1;
+ char w[32];
+ sprintf(w, "%d", i);
+ YAZ_CHECK_EQ(dict_insert(dict, w, sizeof(v), &v), 1);
+ }
+ /* insert again with original value again */
+ for (i = start; i < number; i += 100)
+ {
+ int v = i;
+ char w[32];
+ sprintf(w, "%d", i);
+ YAZ_CHECK_EQ(dict_insert(dict, w, sizeof(v), &v), 1);
+ }
+
+#if 1
+ {
+ char *cs[] = {
+ "4497",
+ "4498",
+ "4499",
+ "45"};
+ YAZ_CHECK_EQ(do_scan(dict, 2, 2, "4499", cs, 0, 0, 3), 0);
+ }
+#endif
+#if 1
+ {
+ char *cs[] = {
+ "4498",
+ "4499",
+ "45",
+ "450"};
+ YAZ_CHECK_EQ(do_scan(dict, 2, 2, "45", cs, 0, 0, 3), 0);
+ }
+#endif
+#if 1
+ /* bug 4592 */
+ {
+ char *cs[] = {
+ "4499",
+ "45", /* missing entry ! */
+ "450",
+ "4500"};
+ YAZ_CHECK_EQ(do_scan(dict, 4, 0, "4501", cs, 0, 0, 4), 0);
+ }
+#endif
+#if 1
+ {
+ char *cs[] = {
+ "9996",
+ "9997",
+ "9998",
+ "9999"};
+ YAZ_CHECK_EQ(do_scan(dict, 4, 0, "a", cs, 0, 0, 4), 0);
+ YAZ_CHECK_EQ(do_scan(dict, 3, 1, "9999", cs, 0, 0, 4), 0);
+ }
+#endif
+#if 1
+ {
+ char *cs[] = {
+ "10",
+ "100",
+ "1000",
+ "1001" };
+ YAZ_CHECK_EQ(do_scan(dict, 0, 4, "10", cs, 0, 0, 4), 0);
+ YAZ_CHECK_EQ(do_scan(dict, 0, 4, "1", cs, 0, 0, 4), 0);
+ YAZ_CHECK_EQ(do_scan(dict, 0, 4, " ", cs, 0, 0, 4), 0);
+ YAZ_CHECK_EQ(do_scan(dict, 0, 4, "", cs, 0, 0, 4), 0);
+ }
+#endif
+#if 1
+ for (i = 0; i < 20; i++)
+ YAZ_CHECK_EQ(do_scan(dict, 20, 20, "45", 0, 0, 20-i, 20+i), 0);
+#endif
+}
+