X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftest_cql2ccl.c;h=06a1c6171d7bd88c2bb64f97a7ecd69f7b46ae4d;hp=e9ebe38d0bb8b1ed741c4ad43079d925956da8f4;hb=1d174be5d92bd388583905b152b0183665460bf6;hpb=b8c32e563453793ed92e311d4585d54fc77fbb04 diff --git a/test/test_cql2ccl.c b/test/test_cql2ccl.c index e9ebe38..06a1c61 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) 1995-2013 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); @@ -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)) ; @@ -110,8 +110,7 @@ static void tst(void) YAZ_CHECK(tst_query("\\*", "\"*\"")); YAZ_CHECK(tst_query("\"\\*\"", "\"*\"")); - YAZ_CHECK(tst_query("a b", "\"a\" \"b\"")); - YAZ_CHECK(tst_query("ab bc", "\"ab\" \"bc\"")); + YAZ_CHECK(tst_query("\"a b\"", "\"a b\"")); YAZ_CHECK(tst_query("\\\\", "\"\\\\\"")); YAZ_CHECK(tst_query("\\\"", "\"\\\"\"")); @@ -131,22 +130,19 @@ static void tst(void) YAZ_CHECK(tst_query("title all \"\"", "title=\"\"")); YAZ_CHECK(tst_query("title all x", "title=\"x\"")); - YAZ_CHECK(tst_query("title all x y", "title=\"x\" and title=\"y\"")); YAZ_CHECK(tst_query("title all \"x y\"", "title=\"x\" and title=\"y\"")); 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("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));