Created
December 15, 2013 03:58
-
-
Save tomoki/7968689 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/sh | |
INPUTS=`find . -type f -name "in*"` | |
PROG=$1 | |
if [ $# -eq 0 ] | |
then | |
echo "Pass program as first argument." | |
exit 1 | |
fi | |
for input in $INPUTS | |
do | |
body=`echo $input | sed -e "s/[0-9]*$//"` | |
index=`echo $input | cut -c $(expr ${#body} + 1)-${#input}` | |
output=./out$index | |
tmp=`mktemp` | |
echo "$input - $output" | |
$PROG < $input > $tmp | |
d=`diff $output $tmp -Z` | |
if [ ${#d} -eq 0 ] | |
then | |
echo -e "\033[0;32mCorrect\033[0;39m" | |
else | |
echo -e "\033[0;31mFailed\033[0;39m" | |
echo "Expected:" | |
cat $output | |
echo | |
echo "Output:" | |
cat $tmp | |
fi | |
rm $tmp | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment