From: Adam Dickmeiss Date: Sun, 6 Jan 2008 21:48:23 +0000 (+0000) Subject: Added tests using cql2pqf. X-Git-Tag: YAZ.3.0.20~15 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=a061444f080ca7a0319bc176b48b0e70e067de13;p=yaz-moved-to-github.git Added tests using cql2pqf. --- diff --git a/test/Makefile.am b/test/Makefile.am index 1bd2325..c4d059a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,17 +1,17 @@ ## Copyright (C) 1995-2007, Index Data ApS ## All rights reserved. -## $Id: Makefile.am,v 1.41 2007-10-24 22:10:24 adam Exp $ +## $Id: Makefile.am,v 1.42 2008-01-06 21:48:23 adam Exp $ check_PROGRAMS = tsticonv tstnmem tstmatchstr tstwrbuf tstodr tstccl tstlog \ tstsoap1 tstsoap2 tstodrstack tstlogthread tstxmlquery tstpquery \ tst_comstack tst_filepath tst_record_conv tst_retrieval tst_tpath \ tst_timing tst_query_charset tst_oid tst_icu_I18N tst_match_glob -check_SCRIPTS = tstcql.sh tstmarc.sh tstmarccol.sh +check_SCRIPTS = tstcql.sh tstmarc.sh tstmarccol.sh tstcql2pqf.sh TESTS = $(check_PROGRAMS) $(check_SCRIPTS) EXTRA_DIST = tstodr.asn tstodrcodec.c tstodrcodec.h cqlsample \ - cql2pqf-order.txt \ + cql2pqf-order.txt cql2pqfsample \ $(check_SCRIPTS) \ marc1.marc marc1.xml marc1.chr marc1.xml.marc \ marc2.marc marc2.xml marc2.chr marc2.xml.marc \ @@ -35,8 +35,9 @@ AM_CPPFLAGS=-I$(top_srcdir)/include $(XML2_CFLAGS) $(ICU_CPPFLAGS) dist-hook: mkdir -p $(distdir)/cql - cp $(srcdir)/cql/*.err $(distdir)/cql - cp $(srcdir)/cql/*.out $(distdir)/cql + cp $(srcdir)/cql/*.err $(srcdir)/cql/*.out $(distdir)/cql + mkdir -p $(distdir)/cql2pqf + cp $(srcdir)/cql2pqf/*.err $(srcdir)/cql2pqf/*.out $(distdir)/cql2pqf # Rule for generating codecs for our small ASN.1 spec tstodrcodec.c tstodrcodec.h: tstodr.asn $(YAZCOMP) diff --git a/test/cql2pqf/1.1.err b/test/cql2pqf/1.1.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/1.1.out b/test/cql2pqf/1.1.out new file mode 100644 index 0000000..b881596 --- /dev/null +++ b/test/cql2pqf/1.1.out @@ -0,0 +1 @@ +@attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "a" diff --git a/test/cql2pqf/1.2.err b/test/cql2pqf/1.2.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/1.2.out b/test/cql2pqf/1.2.out new file mode 100644 index 0000000..de3e6a9 --- /dev/null +++ b/test/cql2pqf/1.2.out @@ -0,0 +1 @@ +@attr 6=1 @attr 2=3 @attr 4=1 @and @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "a" @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "b" diff --git a/test/cql2pqf/1.3.err b/test/cql2pqf/1.3.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/1.3.out b/test/cql2pqf/1.3.out new file mode 100644 index 0000000..e5f2c38 --- /dev/null +++ b/test/cql2pqf/1.3.out @@ -0,0 +1 @@ +@attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "a b" diff --git a/test/cql2pqf/2.1.err b/test/cql2pqf/2.1.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/2.1.out b/test/cql2pqf/2.1.out new file mode 100644 index 0000000..22f9db6 --- /dev/null +++ b/test/cql2pqf/2.1.out @@ -0,0 +1 @@ +@attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=4 "fish" diff --git a/test/cql2pqf/2.2.err b/test/cql2pqf/2.2.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/2.2.out b/test/cql2pqf/2.2.out new file mode 100644 index 0000000..22f9db6 --- /dev/null +++ b/test/cql2pqf/2.2.out @@ -0,0 +1 @@ +@attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=4 "fish" diff --git a/test/cql2pqf/3.1.err b/test/cql2pqf/3.1.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.1.out b/test/cql2pqf/3.1.out new file mode 100644 index 0000000..bc0d04d --- /dev/null +++ b/test/cql2pqf/3.1.out @@ -0,0 +1 @@ +@or @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "cat" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "dog" diff --git a/test/cql2pqf/3.2.err b/test/cql2pqf/3.2.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.2.out b/test/cql2pqf/3.2.out new file mode 100644 index 0000000..7e88a2c --- /dev/null +++ b/test/cql2pqf/3.2.out @@ -0,0 +1 @@ +@and @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "cat" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "fish" diff --git a/test/cql2pqf/3.3.err b/test/cql2pqf/3.3.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.3.out b/test/cql2pqf/3.3.out new file mode 100644 index 0000000..6a9dd4a --- /dev/null +++ b/test/cql2pqf/3.3.out @@ -0,0 +1 @@ +@not @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "cat" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "frog" diff --git a/test/cql2pqf/3.4.err b/test/cql2pqf/3.4.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.4.out b/test/cql2pqf/3.4.out new file mode 100644 index 0000000..6a9dd4a --- /dev/null +++ b/test/cql2pqf/3.4.out @@ -0,0 +1 @@ +@not @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "cat" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "frog" diff --git a/test/cql2pqf/3.5.err b/test/cql2pqf/3.5.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.5.out b/test/cql2pqf/3.5.out new file mode 100644 index 0000000..893ab74 --- /dev/null +++ b/test/cql2pqf/3.5.out @@ -0,0 +1 @@ +@not @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "cat" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "fish food" diff --git a/test/cql2pqf/3.6.err b/test/cql2pqf/3.6.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.6.out b/test/cql2pqf/3.6.out new file mode 100644 index 0000000..7c9d99c --- /dev/null +++ b/test/cql2pqf/3.6.out @@ -0,0 +1 @@ +@and @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "xml" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "prox///" diff --git a/test/cql2pqf/3.7.err b/test/cql2pqf/3.7.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.7.out b/test/cql2pqf/3.7.out new file mode 100644 index 0000000..65f6e63 --- /dev/null +++ b/test/cql2pqf/3.7.out @@ -0,0 +1 @@ +@and @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "fred" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "any" diff --git a/test/cql2pqf/3.8.err b/test/cql2pqf/3.8.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.8.out b/test/cql2pqf/3.8.out new file mode 100644 index 0000000..d43365b --- /dev/null +++ b/test/cql2pqf/3.8.out @@ -0,0 +1 @@ +@or @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "fred" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "all" diff --git a/test/cql2pqf/3.9.err b/test/cql2pqf/3.9.err new file mode 100644 index 0000000..e69de29 diff --git a/test/cql2pqf/3.9.out b/test/cql2pqf/3.9.out new file mode 100644 index 0000000..e1e1637 --- /dev/null +++ b/test/cql2pqf/3.9.out @@ -0,0 +1 @@ +@not @and @or @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "a" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "b" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "c" @attr 6=1 @attr 2=3 @attr 4=1 @attr 3=3 @attr 6=1 @attr 5=100 @attr 1=1016 "d" diff --git a/test/cql2pqfsample b/test/cql2pqfsample new file mode 100644 index 0000000..8bc6a96 --- /dev/null +++ b/test/cql2pqfsample @@ -0,0 +1,26 @@ +# $Id: cql2pqfsample,v 1.1 2008-01-06 21:48:23 adam Exp $ +# CQL queries for testing. +# from http://www.loc.gov/z3950/agency/zing/cql/sample-queries.html +# Simple Term + +a +a b +"a b" + +# Index Relation Term + +title = fish +dc.title = fish + +# Simple Boolean + +cat or dog +cat and fish +cat not frog +(cat not frog) +"cat" not "fish food" +xml and "prox///" +fred and any +((fred or all)) +a or b and c not d + diff --git a/test/tstcql2pqf.sh b/test/tstcql2pqf.sh new file mode 100755 index 0000000..3833d94 --- /dev/null +++ b/test/tstcql2pqf.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# $Id: tstcql2pqf.sh,v 1.1 2008-01-06 21:48:23 adam Exp $ +srcdir=${srcdir:-.} +oIFS="$IFS" +IFS=' +' +secno=0 +testno=0 +comment=0 +ecode=0 +test -f ${srcdir}/cql2pqfsample || exit 1 +test -d cql2pqf || mkdir cql2pqf +for f in `cat ${srcdir}/cql2pqfsample`; do + if echo $f | grep '^#' >/dev/null; then + comment=1 + else + if test "$comment" = "1"; then + secno=`expr $secno + 1` + testno=0 + fi + comment=0 + testno=`expr $testno + 1` + OUT1=${srcdir}/cql2pqf/$secno.$testno.out + ERR1=${srcdir}/cql2pqf/$secno.$testno.err + OUT2=cql2pqf/$secno.$testno.out.tmp + ERR2=cql2pqf/$secno.$testno.err.tmp + DIFF=cql2pqf/$secno.$testno.diff + ../util/cql2pqf ${srcdir}/../etc/pqf.properties "$f" >$OUT2 2>$ERR2 + if test -f $OUT1 -a -f $ERR1; then + if diff $OUT1 $OUT2 >$DIFF; then + rm $DIFF + rm $OUT2 + else + echo "diff out $secno $testno $f" + cat $DIFF + ecode=1 + fi + if diff $ERR1 $ERR2 >$DIFF; then + rm $DIFF + rm $ERR2 + else + echo "diff err $secno $testno $f" + cat $DIFF + ecode=1 + fi + else + echo "making test $secno $testno $f" + mv $OUT2 $OUT1 + mv $ERR2 $ERR1 + ecode=1 + fi + fi +done +IFS="$oIFS" +exit $ecode