Changed include/yaz/diagbib1.h and added include/yaz/diagsrw.h with
[yaz-moved-to-github.git] / test / tstccl.c
index 73c4011..c816601 100644 (file)
@@ -2,11 +2,12 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tstccl.c,v 1.5 2005-01-15 19:47:15 adam Exp $
+ * $Id: tstccl.c,v 1.8 2005-04-15 21:47:56 adam Exp $
  */
 
 /* CCL test */
 
+#include <stdlib.h>
 #include <string.h>
 #include <yaz/ccl.h>
 
@@ -36,6 +37,10 @@ static struct ccl_tst query_str[] = {
     { "x= -1980", "@attr 2=3 -1980 "},
     { "x=234-1990", "@attr 2=3 234-1990 "},
     { "x=234 - 1990", "@and @attr 2=4 234 @attr 2=2 1990 "},
+    { "ti=a,b", "@attr 4=1 @attr 1=4 a,b "},
+    { "ti=a, b", "@attr 4=1 @attr 1=4 a,\\ b "},
+    { "ti=a-b", "@attr 4=2 @attr 1=4 a-b "},
+    { "ti=a - b", "@attr 4=1 @attr 1=4 a\\ -\\ b "},
     {0, 0}
 };
 
@@ -88,9 +93,11 @@ void tst1(int pass, int *number_of_errors)
 
     for (i = 0; query_str[i].query; i++)
     {
-       struct ccl_token *token_list =
-           ccl_parser_tokenize(parser, query_str[i].query);
-       struct ccl_rpn_node *rpn = ccl_parser_find(parser, token_list);
+       struct ccl_token *token_list;
+       struct ccl_rpn_node *rpn;
+
+       token_list = ccl_parser_tokenize(parser, query_str[i].query);
+       rpn = ccl_parser_find(parser, token_list);
        ccl_token_del (token_list);
        if (rpn)
        {
@@ -100,14 +107,14 @@ void tst1(int pass, int *number_of_errors)
            if (!query_str[i].result)
            {
                printf ("Failed %s\n", query_str[i].query);
-               printf (" got:%s:\n", wrbuf_buf(wrbuf));
+               printf (" got:     %s:\n", wrbuf_buf(wrbuf));
                printf (" expected failure\n");
                (*number_of_errors)++;
            }
            else if (strcmp(wrbuf_buf(wrbuf), query_str[i].result))
            {
                printf ("Failed %s\n", query_str[i].query);
-               printf (" got:%s:\n", wrbuf_buf(wrbuf));
+               printf (" got:     %s:\n", wrbuf_buf(wrbuf));
                printf (" expected:%s:\n", query_str[i].result);
                (*number_of_errors)++;
            }