X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Ftstpquery.c;h=82fbd30c119fc01da3ab319064c6cbe7b461971d;hb=0725af5d06bfcdaf9888886f04c63810c1d8cf72;hp=c36e65d6e103f0753a4786289883f483dcdbc0a7;hpb=a7c0fe1d8d8d89204f5c25a72d556d3d67b32d35;p=yaz-moved-to-github.git diff --git a/test/tstpquery.c b/test/tstpquery.c index c36e65d..82fbd30 100644 --- a/test/tstpquery.c +++ b/test/tstpquery.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 1995-2005, Index Data ApS + * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: tstpquery.c,v 1.1 2006-04-01 11:45:23 adam Exp $ + * $Id: tstpquery.c,v 1.5 2007-03-19 14:40:07 adam Exp $ */ #include @@ -45,9 +45,9 @@ int expect_pqf(const char *pqf, const char *expect_pqf, int expect_error) { yaz_rpnquery_to_wrbuf(wrbuf, rpn); - if (!strcmp(wrbuf_buf(wrbuf), expect_pqf)) + if (!strcmp(wrbuf_cstr(wrbuf), expect_pqf)) res = 1; - wrbuf_free(wrbuf, 1); + wrbuf_destroy(wrbuf); } } yaz_pqf_destroy(parser); @@ -55,14 +55,18 @@ int expect_pqf(const char *pqf, const char *expect_pqf, int expect_error) return res; } -static void tst() +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("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)); YAZ_CHECK(expect_pqf("@prox 0 0 0 0 k 0 a b", "@attrset Bib-1 @prox 0 0 0 0 k 0 a b", YAZ_PQF_ERROR_NONE)); + YAZ_CHECK(expect_pqf("@prox 0 0 0 0 3 0 a b", "", + YAZ_PQF_ERROR_PROXIMITY)); } int main (int argc, char **argv)