Last active
April 10, 2019 11:35
-
-
Save tamamu/432fc4fd374f7d38108355a9b15b6279 to your computer and use it in GitHub Desktop.
Check testcases for AtCoder
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 | |
cd `dirname $0` | |
cnt=0 | |
ac=0 | |
if [ -z "$1" ]; then | |
echo "Not set executable file" | |
else | |
echo "Running exec $1:" | |
fi | |
echo | |
for filename in testcases/in*.txt; do | |
cnt=`expr $cnt + 1` | |
num=`echo $filename | awk 'match($0,/in([0-9]+).txt/,a){print a[1]}'` | |
re=0 | |
(time (cat $filename | (./$1 1> /tmp/tmpout))) 2>/tmp/tmptime | |
if [ $? = 0 ]; then | |
(diff /tmp/tmpout testcases/out"$num".txt > /dev/null 3<&0) 1>/dev/null; res=$? | |
else | |
re=1 | |
fi | |
if [ $re = 1 ]; then | |
echo "#$num RE" | |
elif [ $res = 0 ]; then | |
echo "#$num AC" `cat /tmp/tmptime | grep real | cut -f 2` | |
ac=`expr $ac + 1` | |
else | |
echo "#$num WA" `cat /tmp/tmptime | grep real | cut -f 2` | |
fi | |
done | |
echo | |
if [ $ac = $cnt ]; then | |
echo "Test Passed!!" | |
else | |
echo "Failure..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment