X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftest_pquery.c;h=fea0efa21d4bd6a2f0d2420be8e4c1a5603293f9;hp=f76adde9815b97e52db3f5e2fc1ce1b2e8bad0f7;hb=e8117f5e26e3eed1f7b48e1dcb2ce8c12a31fd52;hpb=3107ce3a34993d2f784387f227a50343fff83bbc diff --git a/test/test_pquery.c b/test/test_pquery.c index f76adde..fea0efa 100644 --- a/test/test_pquery.c +++ b/test/test_pquery.c @@ -1,11 +1,15 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include +#include #include #include #include @@ -38,13 +42,15 @@ int expect_pqf(const char *pqf, const char *expect_pqf, int expect_error) else if (expect_error == YAZ_PQF_ERROR_NONE) { WRBUF wrbuf = wrbuf_alloc(); - + if (wrbuf) { yaz_rpnquery_to_wrbuf(wrbuf, rpn); - + if (!strcmp(wrbuf_cstr(wrbuf), expect_pqf)) + { res = 1; + } wrbuf_destroy(wrbuf); } } @@ -57,6 +63,7 @@ static void tst(void) { YAZ_CHECK(expect_pqf("a", "@attrset Bib-1 a", YAZ_PQF_ERROR_NONE)); YAZ_CHECK(expect_pqf("@attr 1=4 a", "@attrset Bib-1 @attr 1=4 a", YAZ_PQF_ERROR_NONE)); + YAZ_CHECK(expect_pqf("@attr 1=title a", "@attrset Bib-1 @attr 1=title a", YAZ_PQF_ERROR_NONE)); YAZ_CHECK(expect_pqf("a b", "", YAZ_PQF_ERROR_EXTRA)); YAZ_CHECK(expect_pqf("@and a", "", YAZ_PQF_ERROR_MISSING)); YAZ_CHECK(expect_pqf("@attr p=q a", "", YAZ_PQF_ERROR_BAD_INTEGER)); @@ -65,6 +72,8 @@ static void tst(void) YAZ_PQF_ERROR_NONE)); YAZ_CHECK(expect_pqf("@prox 0 0 0 0 3 0 a b", "", YAZ_PQF_ERROR_PROXIMITY)); + YAZ_CHECK(expect_pqf("@attr 1=12345678901 x", "@attrset Bib-1 @attr 1=12345678901 x", YAZ_PQF_ERROR_NONE)); + YAZ_CHECK(expect_pqf("@attr 1=1234567890.1 x", "@attrset Bib-1 @attr 1=1234567890.1 x", YAZ_PQF_ERROR_NONE)); } int main (int argc, char **argv)