X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fapi%2Ftest_search.c;h=2b1119f44a754423bcf76895164c40ef2d319bb0;hb=75ad7b1f3d9b7daaeba799df6a38eb74195ef235;hp=6f30c6067caeb85797874c155283c17821709962;hpb=a66b7d79383ae700f3358731eecfe2aafed0e90d;p=idzebra-moved-to-github.git diff --git a/test/api/test_search.c b/test/api/test_search.c index 6f30c60..2b1119f 100644 --- a/test/api/test_search.c +++ b/test/api/test_search.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1994-2010 Index Data + Copyright (C) 1994-2011 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -19,6 +19,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA /** \file \brief test various search attributes */ +#if HAVE_CONFIG_H +#include +#endif #include #include "testlib.h" @@ -56,6 +59,23 @@ const char *myrec[] = { " 2107-09-19 00:00:00\n" "\n" , + "\n" + "" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1" + + "" + "" + , 0} ; static void tst(int argc, char **argv) @@ -154,14 +174,49 @@ static void tst(int argc, char **argv) /* string relations, < */ YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=1 0", 0)); - YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=1 my", 0)); + YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=1 my", 1)); /* string relations, <= */ - YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=2 my", 3)); - YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=2 mn", 0)); + YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=2 my", 4)); + YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=2 mn", 1)); /* = */ YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=3 my", 3)); + YAZ_CHECK( + tl_query(zh, + "@attr 1=4 @attr 2=3 " + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + + + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1" + , 1)); + + YAZ_CHECK( + tl_query_x(zh, + "@attr 1=4 @attr 2=3 " + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "1234567890""1234567890""1234567890""1234567890" + "1234567890" "12" + , 0, 11)); + /* string relations, >= */ YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=4 x", 2)); @@ -174,8 +229,8 @@ static void tst(int argc, char **argv) YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=5 title", 2)); /* always-matches relation */ - YAZ_CHECK(tl_query(zh, "@attr 1=_ALLRECORDS @attr 2=103 {ym}", 5)); - YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=103 {x my}", 4)); + YAZ_CHECK(tl_query(zh, "@attr 1=_ALLRECORDS @attr 2=103 {ym}", 6)); + YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=103 {x my}", 5)); YAZ_CHECK(tl_query_x(zh, "@attr 1=1 @attr 2=103 {x my}", 0, 114)); /* and searches */