From: Dennis Schafroth Date: Mon, 23 Sep 2013 07:27:39 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz X-Git-Tag: v4.2.69~18^2~1 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=1b750a9f8ea0d258fde61f5bac2d5af5bd783eb0;hp=9eb7249e5017426eef8177f99847696e7bc95a33 Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz --- diff --git a/test/test_rpn2cql.c b/test/test_rpn2cql.c index b7a5114..9a717c1 100644 --- a/test/test_rpn2cql.c +++ b/test/test_rpn2cql.c @@ -59,6 +59,11 @@ static void tst1(void) YAZ_CHECK(compare(ct, "abc", "abc")); YAZ_CHECK(compare(ct, "\"a b c\"", "\"a b c\"")); YAZ_CHECK(compare(ct, "@and a b", "a and b")); + YAZ_CHECK(compare(ct, "@or a @and b c", "a or (b and c)")); + YAZ_CHECK(compare(ct, "@or @and a b @and c d", "(a and b) or (c and d)")); + YAZ_CHECK(compare(ct, "@or @or a b @or c d", "(a or b) or (c or d)")); + YAZ_CHECK(compare(ct, "@and @and a b @and c d", "(a and b) and (c and d)")); + YAZ_CHECK(compare(ct, "@attr 1=field abc", "field=abc")); YAZ_CHECK(compare(ct, "@attr 1=4 abc", 0)); /* should fail */ diff --git a/test/test_rpn2solr.c b/test/test_rpn2solr.c index 0b0ddde..e3c3add 100644 --- a/test/test_rpn2solr.c +++ b/test/test_rpn2solr.c @@ -39,7 +39,10 @@ static int compare(solr_transform_t ct, const char *pqf, const char *solr) if (solr && !strcmp(wrbuf_cstr(w), solr)) ret = 1; else - yaz_log(YLOG_LOG, "Exp: %s", solr); + { + yaz_log(YLOG_WARN, " expected: %s", solr ? solr : "null"); + yaz_log(YLOG_WARN, " got: %s", wrbuf_cstr(w)); + } } } wrbuf_destroy(w); @@ -58,6 +61,11 @@ static void tst1(void) YAZ_CHECK(compare(ct, "@and @or a b c", "(a OR b) AND c")); YAZ_CHECK(compare(ct, "@and a b", "a AND b")); YAZ_CHECK(compare(ct, "@or a b", "a OR b")); + YAZ_CHECK(compare(ct, "@or a @and b c", "a OR (b AND c)")); + YAZ_CHECK(compare(ct, "@or @and a b @and c d", "(a AND b) OR (c AND d)")); + YAZ_CHECK(compare(ct, "@or @or a b @or c d", "(a OR b) OR (c OR d)")); + YAZ_CHECK(compare(ct, "@or @or @or a b @or c d @or e f", "(a OR b) OR (c OR d)")); + YAZ_CHECK(compare(ct, "@and @and a b @and c d", "(a AND b) AND (c AND d)")); YAZ_CHECK(compare(ct, "@attr 1=field abc", "field:abc")); YAZ_CHECK(compare(ct, "@attr 1=field \"a b c\"", "field:\"a b c\"")); YAZ_CHECK(compare(ct, "@attr 1=4 abc", 0)); /* should fail */ @@ -135,7 +143,6 @@ static void tst2(void) YAZ_CHECK(compare(ct, "@attr 1=4 @attr 4=1 @attr 6=1 abc", "dc.title:abc")); YAZ_CHECK(compare(ct, "@attr 1=1016 abc", "abc")); - /* Date check */ YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=1 1980", "dc.date:[* TO 1980}")); YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=2 1980", "dc.date:[* TO 1980]"));