Update CQL parser to use CQL 1.1 modifiers for booleans and
[yaz-moved-to-github.git] / test / tstcql.sh
diff --git a/test/tstcql.sh b/test/tstcql.sh
new file mode 100755 (executable)
index 0000000..2f41aba
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+oIFS="$IFS"
+IFS='
+'
+secno=0
+testno=0
+comment=0
+ecode=0
+for f in `cat cqlsample`; 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=cql/$secno.$testno.out
+               ERR1=cql/$secno.$testno.err
+               OUT2=cql/$secno.$testno.out.tmp
+               ERR2=cql/$secno.$testno.err.tmp
+               DIFF=cql/$secno.$testno.diff
+               ../util/cql2xcql "$f" >$OUT2 2>$ERR2
+               if test -f $OUT1 -a -f $ERR1; then
+                       if diff $OUT1 $OUT2 >$DIFF; then
+                               rm $DIFF
+                       else
+                               echo "diff out $secno $testno $f"
+                               cat $DIFF
+                               ecode=1 
+                       fi
+                       if diff $ERR1 $ERR2 >$DIFF; then
+                               rm $DIFF
+                       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