Added tests for pql2cql using relation and truncation.
authorDennis Schafroth <dennis@indexdata.com>
Fri, 6 Nov 2009 10:38:38 +0000 (11:38 +0100)
committerDennis Schafroth <dennis@indexdata.com>
Fri, 6 Nov 2009 10:38:38 +0000 (11:38 +0100)
29 files changed:
test/pqf2cql/1.1.err [new file with mode: 0644]
test/pqf2cql/1.1.out [new file with mode: 0644]
test/pqf2cql/1.2.err [new file with mode: 0644]
test/pqf2cql/1.2.out [new file with mode: 0644]
test/pqf2cql/1.3.err [new file with mode: 0644]
test/pqf2cql/1.3.out [new file with mode: 0644]
test/pqf2cql/1.4.err [new file with mode: 0644]
test/pqf2cql/1.4.out [new file with mode: 0644]
test/pqf2cql/1.5.err [new file with mode: 0644]
test/pqf2cql/1.5.out [new file with mode: 0644]
test/pqf2cql/1.6.err [new file with mode: 0644]
test/pqf2cql/1.6.out [new file with mode: 0644]
test/pqf2cql/1.7.err [new file with mode: 0644]
test/pqf2cql/1.7.out [new file with mode: 0644]
test/pqf2cql/2.1.err [new file with mode: 0644]
test/pqf2cql/2.1.out [new file with mode: 0644]
test/pqf2cql/2.2.err [new file with mode: 0644]
test/pqf2cql/2.2.out [new file with mode: 0644]
test/pqf2cql/2.3.err [new file with mode: 0644]
test/pqf2cql/2.3.out [new file with mode: 0644]
test/pqf2cql/2.4.err [new file with mode: 0644]
test/pqf2cql/2.4.out [new file with mode: 0644]
test/pqf2cql/2.5.err [new file with mode: 0644]
test/pqf2cql/2.5.out [new file with mode: 0644]
test/pqf2cql/2.6.err [new file with mode: 0644]
test/pqf2cql/2.6.out [new file with mode: 0644]
test/pqf2cql/2.6.out.tmp [new file with mode: 0644]
test/pqf2cqlsample [new file with mode: 0644]
test/tstpqf2cql.sh [new file with mode: 0755]

diff --git a/test/pqf2cql/1.1.err b/test/pqf2cql/1.1.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/1.1.out b/test/pqf2cql/1.1.out
new file mode 100644 (file)
index 0000000..dd9a3cc
--- /dev/null
@@ -0,0 +1 @@
+date<1980
diff --git a/test/pqf2cql/1.2.err b/test/pqf2cql/1.2.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/1.2.out b/test/pqf2cql/1.2.out
new file mode 100644 (file)
index 0000000..935b729
--- /dev/null
@@ -0,0 +1 @@
+date<=1980
diff --git a/test/pqf2cql/1.3.err b/test/pqf2cql/1.3.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/1.3.out b/test/pqf2cql/1.3.out
new file mode 100644 (file)
index 0000000..cb2a96b
--- /dev/null
@@ -0,0 +1 @@
+date=1980
diff --git a/test/pqf2cql/1.4.err b/test/pqf2cql/1.4.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/1.4.out b/test/pqf2cql/1.4.out
new file mode 100644 (file)
index 0000000..f4fd9da
--- /dev/null
@@ -0,0 +1 @@
+date>=1980
diff --git a/test/pqf2cql/1.5.err b/test/pqf2cql/1.5.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/1.5.out b/test/pqf2cql/1.5.out
new file mode 100644 (file)
index 0000000..a5dffca
--- /dev/null
@@ -0,0 +1 @@
+date>1980
diff --git a/test/pqf2cql/1.6.err b/test/pqf2cql/1.6.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/1.6.out b/test/pqf2cql/1.6.out
new file mode 100644 (file)
index 0000000..fd93bb1
--- /dev/null
@@ -0,0 +1 @@
+date<>1980
diff --git a/test/pqf2cql/1.7.err b/test/pqf2cql/1.7.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/1.7.out b/test/pqf2cql/1.7.out
new file mode 100644 (file)
index 0000000..cb2a96b
--- /dev/null
@@ -0,0 +1 @@
+date=1980
diff --git a/test/pqf2cql/2.1.err b/test/pqf2cql/2.1.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/2.1.out b/test/pqf2cql/2.1.out
new file mode 100644 (file)
index 0000000..587be6b
--- /dev/null
@@ -0,0 +1 @@
+x
diff --git a/test/pqf2cql/2.2.err b/test/pqf2cql/2.2.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/2.2.out b/test/pqf2cql/2.2.out
new file mode 100644 (file)
index 0000000..587be6b
--- /dev/null
@@ -0,0 +1 @@
+x
diff --git a/test/pqf2cql/2.3.err b/test/pqf2cql/2.3.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/2.3.out b/test/pqf2cql/2.3.out
new file mode 100644 (file)
index 0000000..4da252a
--- /dev/null
@@ -0,0 +1 @@
+*x
diff --git a/test/pqf2cql/2.4.err b/test/pqf2cql/2.4.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/2.4.out b/test/pqf2cql/2.4.out
new file mode 100644 (file)
index 0000000..7851050
--- /dev/null
@@ -0,0 +1 @@
+x*
diff --git a/test/pqf2cql/2.5.err b/test/pqf2cql/2.5.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/2.5.out b/test/pqf2cql/2.5.out
new file mode 100644 (file)
index 0000000..7bccc49
--- /dev/null
@@ -0,0 +1 @@
+*x*
diff --git a/test/pqf2cql/2.6.err b/test/pqf2cql/2.6.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/pqf2cql/2.6.out b/test/pqf2cql/2.6.out
new file mode 100644 (file)
index 0000000..5df7507
--- /dev/null
@@ -0,0 +1 @@
+ERROR
diff --git a/test/pqf2cql/2.6.out.tmp b/test/pqf2cql/2.6.out.tmp
new file mode 100644 (file)
index 0000000..587be6b
--- /dev/null
@@ -0,0 +1 @@
+x
diff --git a/test/pqf2cqlsample b/test/pqf2cqlsample
new file mode 100644 (file)
index 0000000..7b7d0b0
--- /dev/null
@@ -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 (executable)
index 0000000..d180909
--- /dev/null
@@ -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