Created
October 23, 2011 12:46
-
-
Save JanTvrdik/1307328 to your computer and use it in GitHub Desktop.
ProgTest test tool
This file contains 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 | |
if [[ $1 = "" || $2 = "" ]] | |
then | |
echo "Chybí povinné parametry" | |
echo "check-io <programPath> <samplesDir>" | |
exit 1 | |
fi | |
pg="$1" | |
samples="$2" | |
n=$(ls "$samples/"*_in.txt | wc -l); | |
echo "Testuji program $pg..." | |
echo | |
for((i=0;i<$n;i++)); do | |
fn=$(printf "%04d" $i); | |
in="$samples/${fn}_in.txt" | |
out="$samples/${fn}_out.txt" | |
my="$samples/${fn}_my.txt" | |
"$pg" < "$in" > "$my"; | |
dos2unix --d2u "$my"; | |
if diff -y --suppress-common-lines "$my" "$out" > /dev/null | |
then | |
echo "$fn: OK" | |
rm "$my" | |
else | |
echo "$fn: Chyba" | |
echo | |
echo "Vstupní data:" | |
echo "=============" | |
cat "$in" | |
echo | |
echo "Rozdíl:" | |
echo "=======" | |
diff -y --suppress-common-lines "$my" "$out" | |
echo | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment