#!/bin/sh

dotest  () {

	test=$1
	name=$2

	eval "$test" > $name.out
	diff $name.out $name.ref > $name.diff
}

(

	for test in S*
	do
		name=`echo $test | sed 's/\..*//'`
		extn=`echo $test | sed 's/.*\.//'`

		if [  -x "$test" ]
		then
			if [ "$extn" = "pl" ]
			then
				dotest "./$test | xql" $name
				continue
			fi

			if [ "$extn" = "sh" ]
			then
				dotest "./$test      " $name
				continue
			fi

			dotest ./$test $name
			continue
		fi

		if [ "$extn" = "xql" ]
		then
			dotest "xql < $test" $name
			continue
		fi
	done

)	2>errlog
