#!/bin/bash
#!/software/common/gnu/bin/bash
#
# auto test code to see what is good, working code; no need to look too closely
# at working code / figure out what their conceptual error(s) might be.
# 1998 nov 1, bsy, created.
#
# assumes manual untarring, since dir name may change, plus tar could
# create new .login / .cshrc files and mess up account.
#
# Use within the dir.  args should be the student's program oic files (but not
# their test input files)

indir=/home/solaris/ieng9/cs30f/staff/assn3
oic=/home/solaris/ieng9/cs30f/public/bin/oic

indir=/home/bsy/cse30f98/assn3
oic=/home/bsy/cse30f98/oic

ulimit -t 5
score=0

while read infile
do
	read output
	theirs=`$oic -e 0x100 -s 0 -c 1 "$@" $indir/$infile | grep 0000:`
	if [ "x$theirs" = "x$output" ]
	then
		echo "$infile: okay"
		score=`expr $score + 1`
	else
		echo "Expected: $output"
		echo "Got:      $theirs"
		echo "$infile: BAD"
	fi
done < $indir/assn3-oic.tests
echo "Passes $score tests"
