X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftest_cql2ccl.c;h=ecb9be6970a2c9dafbc15585a3e28d558e1319fc;hp=e2f9b5fd76ea1b2e3e8e6a95ae0ac5fdc456da5e;hb=ee3683039be09b0843e3159426ea0eeecb3777ac;hpb=2dbb55981b7169e8e3957e2ea2ea3f7fd5aea530 diff --git a/test/test_cql2ccl.c b/test/test_cql2ccl.c index e2f9b5f..ecb9be6 100644 --- a/test/test_cql2ccl.c +++ b/test/test_cql2ccl.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2011 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ #if HAVE_CONFIG_H @@ -18,7 +18,7 @@ static int tst_query_s(const char *cql, const char *expected_ccl, int ret = 1; CQL_parser cp = cql_parser_create(); int r = cql_parser_string(cp, cql); - + if (r) { yaz_log(YLOG_WARN, "cql: parse error: %s", cql); @@ -36,7 +36,7 @@ static int tst_query_s(const char *cql, const char *expected_ccl, if (!r) { ret = 0; - yaz_log(YLOG_WARN, "cql: diff %s", cql); + yaz_log(YLOG_WARN, "cql: diff: %s", cql); yaz_log(YLOG_WARN, " exp error"); yaz_log(YLOG_WARN, " got ccl %s", wrbuf_cstr(w)); } @@ -52,7 +52,7 @@ static int tst_query_s(const char *cql, const char *expected_ccl, yaz_log(YLOG_WARN, " got error"); } wrbuf_rewind(w); - r = cql_sortby_to_sortkeys(cql_parser_result(cp), + r = cql_sortby_to_sortkeys(cql_parser_result(cp), wrbuf_vp_puts, w); if (expected_keys && !r && !strcmp(wrbuf_cstr(w), expected_keys)) ; @@ -137,12 +137,18 @@ static void tst(void) YAZ_CHECK(tst_query("title any x", "title=\"x\"")); YAZ_CHECK(tst_query("title any x y", "title=\"x\" or title=\"y\"")); YAZ_CHECK(tst_query("title any \"x y\"", "title=\"x\" or title=\"y\"")); + + YAZ_CHECK(tst_query("title = \"x y\"", "title=\"x y\"")); + YAZ_CHECK(tst_query("title = x y", "title=\"x\" \"y\"")); + + YAZ_CHECK(tst_query("title = x y z", "title=\"x\" \"y\" \"z\"")); + YAZ_CHECK(tst_query("dc.title=encyclopedia prox dinosaurs", "(dc.title=\"encyclopedia\") % (\"dinosaurs\")")); YAZ_CHECK(tst_query("dc.title=encyclopedia prox/distance<=3 dinosaurs", "(dc.title=\"encyclopedia\") %3 (\"dinosaurs\")")); YAZ_CHECK(tst_query("dc.title=encyclopedia prox/distance<=3/unit=word " - "dinosaurs", + "dinosaurs", "(dc.title=\"encyclopedia\") %3 (\"dinosaurs\")")); YAZ_CHECK(tst_query("dc.title=encyclopedia prox/distance<=3/unit=phrase " "dinosaurs", 0)); @@ -174,6 +180,8 @@ static void tst(void) "title,,1,0,lowValue")); YAZ_CHECK(tst_query_s("a sortby title/missingHigh", "\"a\"", "title,,1,0,highValue")); + YAZ_CHECK(tst_query_s("a sortby title/sort.missingHigh", "\"a\"", + "title,,1,0,highValue")); YAZ_CHECK(tst_query_s("a sortby title/bogus", "\"a\"", 0)); YAZ_CHECK(tst_query_s("a sortby dc.year dc.author", "\"a\"",