Added test for bad ODR nesting
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 11 Aug 2005 14:00:43 +0000 (14:00 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 11 Aug 2005 14:00:43 +0000 (14:00 +0000)
test/Makefile.am
test/tstodrstack.c [new file with mode: 0644]

index c5c9ab8..686af4a 100644 (file)
@@ -1,9 +1,9 @@
 ## Copyright (C) 1994-2004, Index Data
 ## All rights reserved.
-## $Id: Makefile.am,v 1.6 2005-05-06 11:11:37 adam Exp $
+## $Id: Makefile.am,v 1.7 2005-08-11 14:00:43 adam Exp $
 
 check_PROGRAMS = tsticonv tstnmem tstmatchstr tstwrbuf tstodr tstccl tstlog \
- tstsoap1 tstsoap2
+ tstsoap1 tstsoap2 tstodrstack
 check_SCRIPTS = tstcql.sh tstmarc.sh
 
 TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@@ -38,6 +38,8 @@ tstwrbuf_SOURCES = tstwrbuf.c
 
 tstodr_SOURCES = tstodrcodec.c tstodrcodec.h tstodr.c
 
+tstodrstack_SOURCES = tstodrstack.c
+
 tstccl_SOURCES = tstccl.c
 
 tstlog_SOURCES = tstlog.c
diff --git a/test/tstodrstack.c b/test/tstodrstack.c
new file mode 100644 (file)
index 0000000..8088c19
--- /dev/null
@@ -0,0 +1,34 @@
+#include <stdlib.h>
+#include <yaz/pquery.h>
+#include <yaz/proto.h>
+
+void test1()
+{
+    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);
+    rpn_query->RPNStructure->u.complex->s1 = rpn_query->RPNStructure;
+
+    z_RPNQuery(odr, &rpn_query, 0, 0);
+
+    yaz_pqf_destroy(parser);
+    odr_destroy(odr);
+}
+
+int main(int argc, char **argv)
+{
+    test1();
+    exit(0);
+}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */