/*
- * Copyright (c) 2002-2004, Index Data
+ * Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tstccl.c,v 1.4 2004-09-29 20:37:51 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>
{ "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}
};
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)
{
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)++;
}