X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftest_rpn2solr.c;h=159f949940098c4521895fcb3c25b4cc4fabf443;hp=029552ce5a1fef81bf59fa33155c1fe29928f788;hb=9184b4600f4db1371e57402cd0513318e8a72eef;hpb=8c7858ee7a1266db5ac2e18393ef331cadb687b0 diff --git a/test/test_rpn2solr.c b/test/test_rpn2solr.c index 029552c..159f949 100644 --- a/test/test_rpn2solr.c +++ b/test/test_rpn2solr.c @@ -1,7 +1,10 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2012 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -50,10 +53,6 @@ static void tst1(void) YAZ_CHECK(compare(ct, "abc", "abc")); YAZ_CHECK(compare(ct, "\"a b c\"", "\"a b c\"")); -#if 0 -/* Invalid PQF, so this will never work */ - YAZ_CHECK(compare(ct, "a b", "a b")); -#endif YAZ_CHECK(compare(ct, "@not a b", "a AND NOT b")); YAZ_CHECK(compare(ct, "@and @or a b c", "(a OR b) AND c")); YAZ_CHECK(compare(ct, "@and a b", "a AND b")); @@ -67,9 +66,30 @@ static void tst1(void) solr_transform_define_pattern(ct, "index.foo", "1=bar"); YAZ_CHECK(compare(ct, "@attr 1=bar abc", "foo:abc")); - /* - YAZ_CHECK(compare(ct, "@or @attr 1=1016 water @attr 7=1 @attr 1=4 0", "any:water rank:??"); - */ + + /* Truncation */ + YAZ_CHECK(compare(ct, "@attr 5=1 water", "water*")); + YAZ_CHECK(compare(ct, "@attr 5=2 water", 0)); + YAZ_CHECK(compare(ct, "@attr 5=3 water", 0)); + YAZ_CHECK(compare(ct, "@attr 5=100 water", "water")); + YAZ_CHECK(compare(ct, "@attr 5=101 water", 0)); + YAZ_CHECK(compare(ct, "@attr 5=104 w#ter", "w?ter")); + YAZ_CHECK(compare(ct, "@attr 5=104 w#t?r", "w?t*r")); + YAZ_CHECK(compare(ct, "@attr 5=104 w#te?", "w?te*")); + YAZ_CHECK(compare(ct, "@attr 5=104 w\\#te?", "w?te*")); /* PQF eats # */ + YAZ_CHECK(compare(ct, "@attr 5=104 w\\\\#te?", "w#te*")); + + /* reserved characters */ + YAZ_CHECK(compare(ct, "@attr 5=104 \\\"\\\\\\\\", + "\\\"" "\\\\")); + YAZ_CHECK(compare(ct, "@attr 5=104 \\\"\\\\\\\\\\\"", + "\\\"" "\\\\" "\\\"")); + YAZ_CHECK(compare(ct, "@attr 5=104 \\\"\\\\", "\\\"\\\\")); + + YAZ_CHECK(compare(ct, "@attr 5=104 \\{:\\}", "\\{\\:\\}")); + + YAZ_CHECK(compare(ct, "@attr 5=104 \\\"\\\\\\\\\\\"", + "\\\"" "\\\\" "\\\"")); solr_transform_close(ct); }