Added YAZ_CHECK_TERM which terminates test program. Using yaz/test.h
[yaz-moved-to-github.git] / test / tstxmlquery.c
1 /*
2  * Copyright (C) 1995-2005, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: tstxmlquery.c,v 1.4 2006-01-29 21:59:13 adam Exp $
6  */
7
8 #include <stdlib.h>
9 #include <stdio.h>
10
11 #include <yaz/wrbuf.h>
12 #include <yaz/xmlquery.h>
13 #include <yaz/pquery.h>
14 #include <yaz/test.h>
15
16 static void pqf2xml_text(const char *pqf)
17 {
18     YAZ_PQF_Parser parser = yaz_pqf_create();
19     ODR odr = odr_createmem(ODR_ENCODE);
20     Z_RPNQuery *rpn;
21
22     YAZ_CHECK(parser);
23
24     YAZ_CHECK(odr);
25
26     rpn = yaz_pqf_parse(parser, odr, pqf);
27
28     YAZ_CHECK(rpn);
29
30     yaz_pqf_destroy(parser);
31
32     Z_Query *query = odr_malloc(odr, sizeof(*query));
33     query->which = Z_Query_type_1;
34     query->u.type_1 = rpn;
35
36     odr_destroy(odr);
37 #if HAVE_XML2
38
39 #endif
40 }
41
42 int main (int argc, char **argv)
43 {
44     YAZ_CHECK_INIT(argc, argv);
45
46     pqf2xml_text("@attr 1=4 computer");
47
48     YAZ_CHECK_TERM;
49 }
50
51 /*
52  * Local variables:
53  * c-basic-offset: 4
54  * indent-tabs-mode: nil
55  * End:
56  * vim: shiftwidth=4 tabstop=8 expandtab
57  */
58