From af3536cd462cf09e507f2656dc3f1101bc78ea75 Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Wed, 11 Sep 2013 14:15:52 +0200 Subject: [PATCH] Add tests to non-configuration --- test/test_rpn2solr.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/test_rpn2solr.c b/test/test_rpn2solr.c index c2188d8..3589e7f 100644 --- a/test/test_rpn2solr.c +++ b/test/test_rpn2solr.c @@ -37,9 +37,9 @@ static int compare(solr_transform_t ct, const char *pqf, const char *solr) { yaz_log(YLOG_LOG, "%s -> %s", pqf, wrbuf_cstr(w)); if (solr && !strcmp(wrbuf_cstr(w), solr)) - { ret = 1; - } + else + yaz_log(YLOG_LOG, "Exp: %s", solr); } } wrbuf_destroy(w); @@ -91,6 +91,24 @@ static void tst1(void) YAZ_CHECK(compare(ct, "@attr 5=104 \\\"\\\\\\\\\\\"", "\\\"" "\\\\" "\\\"")); + YAZ_CHECK(compare(ct, "@attr 1=date @attr 2=1 1980", "date:[* TO 1980}")); + YAZ_CHECK(compare(ct, "@attr 1=date @attr 2=2 1980", "date:[* TO 1980]")); + YAZ_CHECK(compare(ct, "@attr 1=date @attr 2=3 1980", "date:1980")); + YAZ_CHECK(compare(ct, "@attr 1=date @attr 2=4 1980", "date:[1980 TO *]")); + YAZ_CHECK(compare(ct, "@attr 1=date @attr 2=5 1980", "date:{1980 TO *]")); + YAZ_CHECK(compare(ct, "@and @attr 1=date @attr 2=2 234 @attr 1=date @attr 2=4 1990", "date:[1990 TO 234]")); + YAZ_CHECK(compare(ct, "@and @attr 1=date @attr 2=2 345 @attr 1=date @attr 2=4 234", "date:[234 TO 345]")); + YAZ_CHECK(compare(ct, "@and @attr 1=date @attr 2=5 234 @attr 1=titl @attr 2=2 1990", "date:{234 TO *] AND titl:[* TO 1990]")); + YAZ_CHECK(compare(ct, "@and @attr 1=date @attr 2=5 234 @attr 1=date @attr 2=2 1990", "date:{234 TO 1990]")); + YAZ_CHECK(compare(ct, "@and @attr 1=date @attr 2=4 234 @attr 1=date @attr 2=2 1990", "date:[234 TO 1990]")); + YAZ_CHECK(compare(ct, "@and @attr 1=date @attr 2=5 234 @attr 1=date @attr 2=1 1990", "date:{234 TO 1990}")); + YAZ_CHECK(compare(ct, "@and @attr 1=date @attr 2=4 234 @attr 1=date @attr 2=2 1990", "date:[234 TO 1990]")); + YAZ_CHECK(compare(ct, "@or @attr 1=date @attr 2=4 234 @attr 1=date @attr 2=2 1990", "date:[234 TO *] OR date:[* TO 1990]")); + YAZ_CHECK(compare(ct, "@or @attr 1=date @attr 2=2 234 @attr 1=date @attr 2=4 1990", "date:[* TO 234] OR date:[1990 TO *]")); + YAZ_CHECK(compare(ct, "@attr 1=date @attr 2=1 1980", "date:[* TO 1980}")); + YAZ_CHECK(compare(ct, "@attr 1=date @attr 2=2 1980", "date:[* TO 1980]")); + YAZ_CHECK(compare(ct, "@and @attr 1=date @attr 2=2 234 @attr 1=date @attr 2=4 1990", "date:[1990 TO 234]")); + solr_transform_close(ct); } -- 1.7.10.4