From 69c2dee55aa204cab368989b8385eda8b83bf2e2 Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Fri, 6 Nov 2009 11:38:38 +0100 Subject: [PATCH] Added tests for pql2cql using relation and truncation. --- test/pqf2cql/1.1.out | 1 + test/pqf2cql/1.2.out | 1 + test/pqf2cql/1.3.out | 1 + test/pqf2cql/1.4.out | 1 + test/pqf2cql/1.5.out | 1 + test/pqf2cql/1.6.out | 1 + test/pqf2cql/1.7.out | 1 + test/pqf2cql/2.1.out | 1 + test/pqf2cql/2.2.out | 1 + test/pqf2cql/2.3.out | 1 + test/pqf2cql/2.4.out | 1 + test/pqf2cql/2.5.out | 1 + test/pqf2cql/2.6.out | 1 + test/pqf2cql/2.6.out.tmp | 1 + test/pqf2cqlsample | 20 +++++++++++++++++ test/tstpqf2cql.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 16 files changed, 88 insertions(+) create mode 100644 test/pqf2cql/1.1.err create mode 100644 test/pqf2cql/1.1.out create mode 100644 test/pqf2cql/1.2.err create mode 100644 test/pqf2cql/1.2.out create mode 100644 test/pqf2cql/1.3.err create mode 100644 test/pqf2cql/1.3.out create mode 100644 test/pqf2cql/1.4.err create mode 100644 test/pqf2cql/1.4.out create mode 100644 test/pqf2cql/1.5.err create mode 100644 test/pqf2cql/1.5.out create mode 100644 test/pqf2cql/1.6.err create mode 100644 test/pqf2cql/1.6.out create mode 100644 test/pqf2cql/1.7.err create mode 100644 test/pqf2cql/1.7.out create mode 100644 test/pqf2cql/2.1.err create mode 100644 test/pqf2cql/2.1.out create mode 100644 test/pqf2cql/2.2.err create mode 100644 test/pqf2cql/2.2.out create mode 100644 test/pqf2cql/2.3.err create mode 100644 test/pqf2cql/2.3.out create mode 100644 test/pqf2cql/2.4.err create mode 100644 test/pqf2cql/2.4.out create mode 100644 test/pqf2cql/2.5.err create mode 100644 test/pqf2cql/2.5.out create mode 100644 test/pqf2cql/2.6.err create mode 100644 test/pqf2cql/2.6.out create mode 100644 test/pqf2cql/2.6.out.tmp create mode 100644 test/pqf2cqlsample create mode 100755 test/tstpqf2cql.sh diff --git a/test/pqf2cql/1.1.err b/test/pqf2cql/1.1.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/1.1.out b/test/pqf2cql/1.1.out new file mode 100644 index 0000000..dd9a3cc --- /dev/null +++ b/test/pqf2cql/1.1.out @@ -0,0 +1 @@ +date<1980 diff --git a/test/pqf2cql/1.2.err b/test/pqf2cql/1.2.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/1.2.out b/test/pqf2cql/1.2.out new file mode 100644 index 0000000..935b729 --- /dev/null +++ b/test/pqf2cql/1.2.out @@ -0,0 +1 @@ +date<=1980 diff --git a/test/pqf2cql/1.3.err b/test/pqf2cql/1.3.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/1.3.out b/test/pqf2cql/1.3.out new file mode 100644 index 0000000..cb2a96b --- /dev/null +++ b/test/pqf2cql/1.3.out @@ -0,0 +1 @@ +date=1980 diff --git a/test/pqf2cql/1.4.err b/test/pqf2cql/1.4.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/1.4.out b/test/pqf2cql/1.4.out new file mode 100644 index 0000000..f4fd9da --- /dev/null +++ b/test/pqf2cql/1.4.out @@ -0,0 +1 @@ +date>=1980 diff --git a/test/pqf2cql/1.5.err b/test/pqf2cql/1.5.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/1.5.out b/test/pqf2cql/1.5.out new file mode 100644 index 0000000..a5dffca --- /dev/null +++ b/test/pqf2cql/1.5.out @@ -0,0 +1 @@ +date>1980 diff --git a/test/pqf2cql/1.6.err b/test/pqf2cql/1.6.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/1.6.out b/test/pqf2cql/1.6.out new file mode 100644 index 0000000..fd93bb1 --- /dev/null +++ b/test/pqf2cql/1.6.out @@ -0,0 +1 @@ +date<>1980 diff --git a/test/pqf2cql/1.7.err b/test/pqf2cql/1.7.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/1.7.out b/test/pqf2cql/1.7.out new file mode 100644 index 0000000..cb2a96b --- /dev/null +++ b/test/pqf2cql/1.7.out @@ -0,0 +1 @@ +date=1980 diff --git a/test/pqf2cql/2.1.err b/test/pqf2cql/2.1.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/2.1.out b/test/pqf2cql/2.1.out new file mode 100644 index 0000000..587be6b --- /dev/null +++ b/test/pqf2cql/2.1.out @@ -0,0 +1 @@ +x diff --git a/test/pqf2cql/2.2.err b/test/pqf2cql/2.2.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/2.2.out b/test/pqf2cql/2.2.out new file mode 100644 index 0000000..587be6b --- /dev/null +++ b/test/pqf2cql/2.2.out @@ -0,0 +1 @@ +x diff --git a/test/pqf2cql/2.3.err b/test/pqf2cql/2.3.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/2.3.out b/test/pqf2cql/2.3.out new file mode 100644 index 0000000..4da252a --- /dev/null +++ b/test/pqf2cql/2.3.out @@ -0,0 +1 @@ +*x diff --git a/test/pqf2cql/2.4.err b/test/pqf2cql/2.4.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/2.4.out b/test/pqf2cql/2.4.out new file mode 100644 index 0000000..7851050 --- /dev/null +++ b/test/pqf2cql/2.4.out @@ -0,0 +1 @@ +x* diff --git a/test/pqf2cql/2.5.err b/test/pqf2cql/2.5.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/2.5.out b/test/pqf2cql/2.5.out new file mode 100644 index 0000000..7bccc49 --- /dev/null +++ b/test/pqf2cql/2.5.out @@ -0,0 +1 @@ +*x* diff --git a/test/pqf2cql/2.6.err b/test/pqf2cql/2.6.err new file mode 100644 index 0000000..e69de29 diff --git a/test/pqf2cql/2.6.out b/test/pqf2cql/2.6.out new file mode 100644 index 0000000..5df7507 --- /dev/null +++ b/test/pqf2cql/2.6.out @@ -0,0 +1 @@ +ERROR diff --git a/test/pqf2cql/2.6.out.tmp b/test/pqf2cql/2.6.out.tmp new file mode 100644 index 0000000..587be6b --- /dev/null +++ b/test/pqf2cql/2.6.out.tmp @@ -0,0 +1 @@ +x diff --git a/test/pqf2cqlsample b/test/pqf2cqlsample new file mode 100644 index 0000000..7b7d0b0 --- /dev/null +++ b/test/pqf2cqlsample @@ -0,0 +1,20 @@ +# CQL queries for testing. +# from http://www.loc.gov/z3950/agency/zing/cql/sample-queries.html +# Simple Term + +# Index Relation Term +@attr 1=date @attr 2=1 1980 +@attr 1=date @attr 2=2 1980 +@attr 1=date @attr 2=3 1980 +@attr 1=date @attr 2=4 1980 +@attr 1=date @attr 2=5 1980 +@attr 1=date @attr 2=6 1980 +@attr 1=date @attr 2=x 1980 + +# Truncation +x +@attr 5=100 x +@attr 5=1 x +@attr 5=2 x +@attr 5=3 x +@attr 5=other x \ No newline at end of file diff --git a/test/tstpqf2cql.sh b/test/tstpqf2cql.sh new file mode 100755 index 0000000..d180909 --- /dev/null +++ b/test/tstpqf2cql.sh @@ -0,0 +1,54 @@ +#!/bin/sh +srcdir=${srcdir:-.} +oIFS="$IFS" +IFS=' +' +secno=0 +testno=0 +comment=0 +ecode=0 +test -f ${srcdir}/pqf2cqlsample || exit 1 +test -d pqf2cql || mkdir pqf2cql +for f in `cat ${srcdir}/pqf2cqlsample`; 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}/pqf2cql/$secno.$testno.out + ERR1=${srcdir}/pqf2cql/$secno.$testno.err + OUT2=pqf2cql/$secno.$testno.out.tmp + ERR2=pqf2cql/$secno.$testno.err.tmp + DIFF=pqf2cql/$secno.$testno.diff + ../util/cql2pqf -r - "$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 -- 1.7.10.4