#!/bin/sh
testpath=FIXME
cd $testpath
tests=`ls *.txt`
cd -
make
grade=0
for t in $tests
do
  java -classpath src edu.du.cs.comp3351.p7.Verifier < $testpath/$t > $t.out 2> $t.tmp
  cat $t.tmp | awk '{print $1}' > $t.err
  out_passed=`diff $testpath/$t.out $t.out | wc -l`
  err_passed=`diff $testpath/$t.err $t.err | wc -l`
  sum=`expr $out_passed + $err_passed`
  if [ $sum == 0  ]
  then
    grade=`expr $grade + 1`
    echo "Test $t passed!" 
    rm $t.err $t.out $t.tmp
  else
    echo "Test $t failed!"
  fi
done
