Created
April 29, 2016 20:55
-
-
Save prmichaelsen/cd7f0da0fa69b1636b3d88ceb2c25a28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
let count0=0 | |
for f in $(ls ./tests/*.txt); do | |
./a.out 0 < $f > ./tests/`basename $f .txt`.output; | |
diff -Bw ./tests/`basename $f .txt`.output ${f}.expected > ./tests/`basename $f .txt`.diff; | |
done; | |
for f in $(ls tests/*.txt); do | |
echo "========================================================"; | |
echo "TEST CASE:" `basename $f .txt`; | |
echo "========================================================"; | |
d0=./tests/`basename $f .txt`.diff; | |
if [ -s $d0 ]; then | |
echo "There is an output missmatch:" | |
cat $d0 | |
else | |
count0=$((count0 + 1)); | |
echo "Test: Passed. See output:" | |
cat ./tests/`basename $f .txt`.output; | |
fi | |
done | |
echo | |
echo "Number of passed test cases:" $count0; | |
echo "usage: runs tests in ./tests/ against ./a.out" | |
rm tests/*.output? | |
rm tests/*.diff? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment