X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftest_ccl.c;h=76d76baed84042e8d1a6ac0319198943f2c02e12;hp=f3b04b3b2901e89f9e80b02568ca1df37859af5d;hb=26e1223d0b98f56cf288fb8fdf1acaa15047db2b;hpb=d0e351c12fff564d876958e860338d43716dc269 diff --git a/test/test_ccl.c b/test/test_ccl.c index f3b04b3..76d76ba 100644 --- a/test/test_ccl.c +++ b/test/test_ccl.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. */ #if HAVE_CONFIG_H @@ -67,12 +67,19 @@ void tst1(int pass) if (!bibset) return; + if (pass == 1) + { + CCL_bibset nbibset = ccl_qual_dup(bibset); + ccl_qual_rm(&bibset); + bibset = nbibset; + } + switch(pass) { case 0: ccl_qual_fitem(bibset, "u=4 s=pw t=l,r", "ti"); ccl_qual_fitem(bibset, "1=1016 s=al,pw t=r", "term"); - ccl_qual_fitem(bibset, "1=/my/title", "dc.title"); + ccl_qual_fitem(bibset, "1=/my/title t=x", "dc.title"); ccl_qual_fitem(bibset, "r=r", "date"); ccl_qual_fitem(bibset, "r=o", "x"); ccl_qual_fitem(bibset, "dc.title", "title"); @@ -85,7 +92,7 @@ void tst1(int pass) strcpy(tstline, "term 1=1016 s=al,pw t=r # default term"); ccl_qual_line(bibset, tstline); - strcpy(tstline, "dc.title 1=/my/title"); + strcpy(tstline, "dc.title 1=/my/title t=x"); ccl_qual_line(bibset, tstline); strcpy(tstline, "date r=r # ordered relation"); @@ -104,7 +111,7 @@ void tst1(int pass) ccl_qual_buf(bibset, "ti u=4 s=pw t=l,r\n" "term 1=1016 s=al,pw t=r\r\n" "\n" - "dc.title 1=/my/title\n" + "dc.title 1=/my/title t=x\n" "date r=r\n" "x r=o\n" "title dc.title\n" @@ -132,6 +139,7 @@ void tst1(int pass) " \n" " \n" " \n" + " \n" " \n" " \n" " \n" @@ -166,6 +174,11 @@ void tst1(int pass) } YAZ_CHECK(tst_ccl_query(bibset, "x1", "@attr 4=2 @attr 1=1016 x1 ")); + + YAZ_CHECK(tst_ccl_query(bibset, "k\xc3\xb8" "benhavn", "@attr 4=2 @attr 1=1016 k\xc3\xb8" "benhavn ")); + + YAZ_CHECK(tst_ccl_query(bibset, "k\xf8" "benhavn", "@attr 4=2 @attr 1=1016 ""k\xf8" "benhavn ")); + YAZ_CHECK(tst_ccl_query(bibset, "(((((x1)))))", "@attr 4=2 @attr 1=1016 x1 ")); YAZ_CHECK(tst_ccl_query(bibset, "x1 and x2", "@and " @@ -238,14 +251,45 @@ void tst1(int pass) YAZ_CHECK(tst_ccl_query(bibset, "title=a", "@attr 1=/my/title a ")); + YAZ_CHECK(tst_ccl_query(bibset, "title=a?b#\"c?\"", + "@attr 5=102 @attr 1=/my/title a.*b.c\\\\? ")); + + YAZ_CHECK(tst_ccl_query(bibset, "title=\\(", + "@attr 5=102 @attr 1=/my/title \\\\( ")); + + YAZ_CHECK(tst_ccl_query(bibset, "title=.", + "@attr 5=102 @attr 1=/my/title \\\\. ")); + + YAZ_CHECK(tst_ccl_query(bibset, "title=.", + "@attr 5=102 @attr 1=/my/title \\\\. ")); + + YAZ_CHECK(tst_ccl_query(bibset, "title=\".\"", + "@attr 5=102 @attr 1=/my/title \\\\. ")); + + YAZ_CHECK(tst_ccl_query(bibset, "title=?\\?", + "@attr 5=102 @attr 1=/my/title .*\\\\? ")); + + YAZ_CHECK(tst_ccl_query(bibset, "title=\"?\\?\"", + "@attr 5=102 @attr 1=/my/title \\\\?\\\\? ")); + + YAZ_CHECK(tst_ccl_query(bibset, "title=\\\\", + "@attr 5=102 @attr 1=/my/title \\\\\\\\ ")); + + YAZ_CHECK(tst_ccl_query(bibset, "\\\\", + "@attr 4=2 @attr 1=1016 \\\\ ")); + YAZ_CHECK(tst_ccl_query(bibset, "comb=a", "@or @attr 4=2 @attr 1=1016 a " "@attr 1=/my/title a ")); YAZ_CHECK(tst_ccl_query(bibset, "a? b?", - /* correct */ "@and @attr 5=1 @attr 4=2 @attr 1=1016 a " "@attr 5=1 @attr 4=2 @attr 1=1016 b ")); + + YAZ_CHECK(tst_ccl_query(bibset, "\"a\"? \"b?\"", + "@and @attr 5=1 @attr 4=2 @attr 1=1016 a " + "@attr 4=2 @attr 1=1016 b? ")); + ccl_qual_rm(&bibset); }