Issue diagnostic for scan if 'set' in @attr 8=set does not exist.
[idzebra-moved-to-github.git] / test / api / t11.c
index 79660e1..38dd43d 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id: t11.c,v 1.6 2006-08-14 10:40:22 adam Exp $
-   Copyright (C) 1995-2006
+/* $Id: t11.c,v 1.10 2007-05-08 14:49:38 adam Exp $
+   Copyright (C) 1995-2007
    Index Data ApS
 
 This file is part of the Zebra server.
@@ -38,6 +38,27 @@ static void tst(int argc, char **argv)
 
     YAZ_CHECK(tl_init_data(zh, myrec));
 
+    /*
+      int tl_scan
+      (
+      ZebraHandle zh, const char *query,
+      int pos, int num,
+      int exp_pos, int exp_num, int exp_partial,
+      const char **exp_entries
+      )
+    */
+
+#if 0
+    if (1)
+    {
+       /* bad string use attrite, bug #647 */
+       YAZ_CHECK(tl_scan(zh, "@attr 1=bad 0", 1, 1, 1, 1, 0, 0));
+    }
+    if (1)
+    {
+       /* bad numeric use attributes, bug #647 */
+       YAZ_CHECK(tl_scan(zh, "@attr 1=1234 0", 1, 1, 1, 1, 0, 0));
+    }
     if (1)
     {
        /* scan before. nothing must be returned */
@@ -47,7 +68,8 @@ static void tst(int argc, char **argv)
     if (1)
     {
        /* scan after. nothing must be returned */
-       YAZ_CHECK(tl_scan(zh, "@attr 1=4 m", 1, 1, 1, 0, 1, 0));
+       const char *ent[] = { 0 };
+       YAZ_CHECK(tl_scan(zh, "@attr 1=4 m", 1, 1, 1, 0, 1, ent));
     }
     if (1)
     {
@@ -121,8 +143,30 @@ static void tst(int argc, char **argv)
     }
     if (1)
     {
-       YAZ_CHECK(tl_scan(zh, "@attr 1=4 z", -22, 10, -22, 0, 1, 0));
+       const char *ent[] = { 0 };
+       YAZ_CHECK(tl_scan(zh, "@attr 1=4 z", -22, 10, -22, 0, 1, ent));
     }
+
+#endif
+
+    if (1)
+    {
+       const char *ent[] = { "a", "b", "c", "d", "e", "f", 0 };
+
+        YAZ_CHECK(tl_query(zh, "@attr 1=4 c", 1));
+
+        /* must fail, because x is not a result set */
+       YAZ_CHECK(tl_scan(zh, "@attr 8=x @attr 1=4 a", 1, 3, 0, 0, 0, 0));
+
+#if 0
+        /* bug 1114 */
+       YAZ_CHECK(tl_scan(zh, "@attr 8=rsetname @attr 1=4 0",
+                          1, 20, 1, 6, 1, ent));
+#endif
+
+    }
+
+
     YAZ_CHECK(tl_close_down(zh, zs));
 }