Created
October 30, 2021 16:38
-
-
Save adithya-badidey/5ebb114b3d69e075b57f8f7ce18b2f3f to your computer and use it in GitHub Desktop.
kattis.com Testcase Evaluator for Python
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 | |
## Directory Structure | |
# problem-folder/ | |
# ├─ 1.in | |
# ├─ 1.ans | |
# ├─ ... | |
# ├─ main.py <- Your source file | |
# ├─ tester.sh | |
# > ./tester.sh | |
for ((i = 1 ; i <= 1000 ; i++)); do | |
if [ ! -f "$i.in" ]; then | |
# printf $i".in not found\n" | |
exit 0 | |
fi | |
rm "$i".test | |
python main.py < $i.in > $i.test | |
if cmp -s "$i".ans "$i".test; then | |
printf "Testcase $i passes\n" | |
else | |
printf "++++++++++++++++++++++\n" | |
printf "\n" | |
printf "Testcase $i failed\n" | |
printf "\n" | |
printf "==== Your solution ===\n" | |
cat "$i".test | |
printf "=== Actual solution ==\n" | |
cat "$i".ans | |
printf "\n" | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment