From: Adam Dickmeiss Date: Thu, 11 Aug 2005 14:08:38 +0000 (+0000) Subject: Test with 100 level query and another with circular refernce X-Git-Tag: YAZXF2.1.4.2.2.release~9 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=aa8977f5880c963f6754cc0c4bfa05ef023e83a4 Test with 100 level query and another with circular refernce --- diff --git a/test/tstodrstack.c b/test/tstodrstack.c index 8088c19..06b724a 100644 --- a/test/tstodrstack.c +++ b/test/tstodrstack.c @@ -2,19 +2,52 @@ #include #include +/** \brief build a 100 level query */ void test1() { ODR odr = odr_createmem(ODR_ENCODE); YAZ_PQF_Parser parser = yaz_pqf_create(); Z_RPNQuery *rpn_query; + char qstr[10000]; + int i; + + *qstr = '\0'; + for (i = 0; i<100; i++) + strcat(qstr, "@and 1 "); + strcat(qstr, "1"); + + rpn_query = yaz_pqf_parse (parser, odr, qstr); + + if (!rpn_query) + exit(1); + + if (!z_RPNQuery(odr, &rpn_query, 0, 0)) + { + odr_perror(odr, "Encoding query"); + exit(1); + } + + yaz_pqf_destroy(parser); + odr_destroy(odr); +} + +/** \brief build a circular referenced query */ +void test2() +{ + ODR odr = odr_createmem(ODR_ENCODE); + YAZ_PQF_Parser parser = yaz_pqf_create(); + Z_RPNQuery *rpn_query; rpn_query = yaz_pqf_parse (parser, odr, "@and @and a b c"); if (!rpn_query) exit(1); + + /* make a bad recursive refernce */ rpn_query->RPNStructure->u.complex->s1 = rpn_query->RPNStructure; - z_RPNQuery(odr, &rpn_query, 0, 0); + if (!z_RPNQuery(odr, &rpn_query, 0, 0)) + odr_perror(odr, "Encoding query"); yaz_pqf_destroy(parser); odr_destroy(odr); @@ -23,6 +56,7 @@ void test1() int main(int argc, char **argv) { test1(); + test2(); exit(0); } /*