ab339354589b87c541393abe59b7a92d4240ab64
[uebersetzerbau-ss10.git] / parser / 09test.sh
1 #!/bin/sh
2
3 beispiel=parser
4 allow_null_glob_expansion=1
5 shopt -s nullglob
6 PROGRAM=./$beispiel
7 errnum=0
8 prgnum=0
9
10 LOC=~/test/$beispiel/
11
12 for i in $LOC/*.[012]
13 do
14         echo "---------------------------------------------------------------------"
15         echo "Test file: $i"
16         echo "Input:"
17         echo "======"
18         echo
19         cat $i
20         echo
21         let prgnum=prgnum+1
22         $PROGRAM <$i >/dev/null 2>/dev/null
23         retval=$?
24         if test $retval -eq ${i##*.}
25         then
26                 echo "Correct exit status."
27         else
28                 echo "[Error] Status is $retval but ${i##*.} was expected!"
29                 echo   
30                 let errnum=errnum+1   
31         fi
32 done
33 echo "---------------------------------------------------------------------"
34 echo
35 let corrnum=prgnum-errnum
36 echo "Statistics:"
37 echo "==========="
38 echo "           $prgnum Tests total"
39 echo "           $corrnum Tests passed"
40 echo "           $errnum Tests failed"