Update CQL parser to use CQL 1.1 modifiers for booleans and
[yaz-moved-to-github.git] / test / tstcql.sh
1 #!/bin/sh
2 oIFS="$IFS"
3 IFS='
4 '
5 secno=0
6 testno=0
7 comment=0
8 ecode=0
9 for f in `cat cqlsample`; do
10         if echo $f | grep '^#' >/dev/null; then
11                 comment=1
12         else
13                 if test "$comment" = "1"; then
14                         secno=`expr $secno + 1`
15                         testno=0
16                 fi
17                 comment=0
18                 testno=`expr $testno + 1`
19                 OUT1=cql/$secno.$testno.out
20                 ERR1=cql/$secno.$testno.err
21                 OUT2=cql/$secno.$testno.out.tmp
22                 ERR2=cql/$secno.$testno.err.tmp
23                 DIFF=cql/$secno.$testno.diff
24                 ../util/cql2xcql "$f" >$OUT2 2>$ERR2
25                 if test -f $OUT1 -a -f $ERR1; then
26                         if diff $OUT1 $OUT2 >$DIFF; then
27                                 rm $DIFF
28                         else
29                                 echo "diff out $secno $testno $f"
30                                 cat $DIFF
31                                 ecode=1 
32                         fi
33                         if diff $ERR1 $ERR2 >$DIFF; then
34                                 rm $DIFF
35                         else
36                                 echo "diff err $secno $testno $f"
37                                 cat $DIFF
38                                 ecode=1
39                         fi
40                 else
41                         echo "making test $secno $testno $f"
42                         mv $OUT2 $OUT1
43                         mv $ERR2 $ERR1
44                         ecode=1
45                 fi      
46         fi              
47 done
48 IFS="$oIFS"
49 exit $ecode