From bedf53c5f2d3e240608d27a71037777fada559d3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 27 Jan 2006 17:33:15 +0000 Subject: [PATCH] First use of unit test macros. --- test/Makefile.am | 17 ++++------------ test/tstxmlquery.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 test/tstxmlquery.c diff --git a/test/Makefile.am b/test/Makefile.am index 5854785..790603c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,9 +1,9 @@ -## Copyright (C) 1994-2004, Index Data +## Copyright (C) 1994-2006, Index Data ## All rights reserved. -## $Id: Makefile.am,v 1.10 2005-11-02 13:32:58 adam Exp $ +## $Id: Makefile.am,v 1.11 2006-01-27 17:33:15 adam Exp $ check_PROGRAMS = tsticonv tstnmem tstmatchstr tstwrbuf tstodr tstccl tstlog \ - tstsoap1 tstsoap2 tstodrstack tstlogthread + tstsoap1 tstsoap2 tstodrstack tstlogthread tstxmlquery check_SCRIPTS = tstcql.sh tstmarc.sh TESTS = $(check_PROGRAMS) $(check_SCRIPTS) @@ -31,24 +31,15 @@ tstodrcodec.c tstodrcodec.h: tstodr.asn $(YAZCOMP) LDADD = ../src/libyaz.la tsticonv_SOURCES = tsticonv.c - tstnmem_SOURCES = tstnmem.c - tstmatchstr_SOURCES = tstmatchstr.c - tstwrbuf_SOURCES = tstwrbuf.c - tstodr_SOURCES = tstodrcodec.c tstodrcodec.h tstodr.c - tstodrstack_SOURCES = tstodrstack.c - tstccl_SOURCES = tstccl.c - tstlog_SOURCES = tstlog.c - tstsoap1_SOURCES = tstsoap1.c - tstsoap2_SOURCES = tstsoap2.c - tstlogthread_SOURCES = tstlogthread.c +tstxmlquery_SOURCES = tstxmlquery.c diff --git a/test/tstxmlquery.c b/test/tstxmlquery.c new file mode 100644 index 0000000..c72343e --- /dev/null +++ b/test/tstxmlquery.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) 1995-2005, Index Data ApS + * See the file LICENSE for details. + * + * $Id: tstxmlquery.c,v 1.1 2006-01-27 17:33:15 adam Exp $ + */ + +#include +#include + +#include +#include +#include +#include + +#if HAVE_XML2 +static void pqf2xml_text(const char *pqf) +{ + YAZ_PQF_Parser parser = yaz_pqf_create(); + ODR odr = odr_createmem(ODR_ENCODE); + Z_RPNQuery *rpn; + + YAZ_CHECK(parser); + + YAZ_CHECK(odr); + + rpn = yaz_pqf_parse(parser, odr, pqf); + + YAZ_CHECK(rpn); + + yaz_pqf_destroy(parser); + + Z_Query *query = odr_malloc(odr, sizeof(*query)); + query->which = Z_Query_type_1; + query->u.type_1 = rpn; + + odr_destroy(odr); +} +#endif + +int main (int argc, char **argv) +{ + pqf2xml_text("@attr 1=4 computer"); + + exit(0); + return 0; +} + +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ + -- 1.7.10.4