#!/bin/sh

NUMCHECK=`ls $srcdir/check*.sql | wc | awk '{ print $1 }'`

echo 1..$NUMCHECK # Number of tests to be executed.

CEGO=../src/cego
DBXML=db/cegodb.xml
$srcdir/mkdb > check.stdout

CHECKCOUNT=1
for CHECK in `ls $srcdir/check*.sql`
do
    CHECKTITLE=`cat $CHECK | grep '###'  | sed 's/--//'`
    $CEGO --mode=batch --batchfile=$CHECK --dbxml=$DBXML --user=lemke/lemke --poolsize=5000 --tableset=TS1 >> check.stdout
    if [ $? -eq 0 ]
    then
	echo "ok $CHECKCOUNT - $CHECKTITLE"
    else
	echo "not ok $CHECKCOUNT - $CHECKTITLE"
    fi
    CHECKCOUNT=`expr $CHECKCOUNT + 1 `
 
done


exit 0
