926d2b621e
The idea is simple: each print represents a testcase within a test unit. As we don't have strict rules on which/how many testcase are put into a test file, it's nice to have an idea how many *testcases* we have totally. Would be nice to count how many testcases pass/fail, but that's a bit less trivial.
46 lines
917 B
Bash
Executable File
46 lines
917 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
RM="/bin/rm -f"
|
|
CPYTHON3=python3.3
|
|
MP_PY=../../unix/py
|
|
|
|
numtests=0
|
|
numtestcases=0
|
|
numpassed=0
|
|
numfailed=0
|
|
namefailed=
|
|
|
|
for infile in tests/*.py
|
|
do
|
|
basename=`basename $infile .py`
|
|
outfile=${basename}.out
|
|
expfile=${basename}.exp
|
|
|
|
$CPYTHON3 -B $infile > $expfile
|
|
$MP_PY $infile > $outfile
|
|
((numtestcases = numtestcases + $(cat $expfile | wc -l)))
|
|
|
|
diff --brief $expfile $outfile > /dev/null
|
|
|
|
if [ $? -eq 0 ]
|
|
then
|
|
echo "pass $infile"
|
|
$RM $outfile
|
|
$RM $expfile
|
|
((numpassed=numpassed + 1))
|
|
else
|
|
echo "FAIL $infile"
|
|
((numfailed=numfailed + 1))
|
|
namefailed="$namefailed $basename"
|
|
fi
|
|
|
|
((numtests=numtests + 1))
|
|
done
|
|
|
|
echo "$numtests tests performed ($numtestcases individual testcases)"
|
|
echo "$numpassed tests passed"
|
|
if [[ $numfailed != 0 ]]
|
|
then
|
|
echo "$numfailed tests failed -$namefailed"
|
|
fi
|