X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Ftstccl.c;h=c81660134b05a9fe1338754cf0908a380a6f1903;hb=84d7b06c13daa609e93f353e655c4b02f936d65c;hp=73c4011889fb1bd91103fe421b51aeb6129fdf1b;hpb=4c176312acdc3444c9afc820f76a393e64668e52;p=yaz-moved-to-github.git diff --git a/test/tstccl.c b/test/tstccl.c index 73c4011..c816601 100644 --- a/test/tstccl.c +++ b/test/tstccl.c @@ -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 #include #include @@ -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)++; }