competitive programming scripts on Linux
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#!/bin/bash
PROG="Main"
[ ! -f *.in ] && echo -e "No input found.\n" && exit 127 # compilation stage. # using sanitizers to prevent dumb buffer overflows. make $PROG || exit 1
# diffing program output against actual output. for i in *.in; do NAME=$(echo $i | sed "s/.in//g") echo -e "running test: $NAME \n" echo -e "INPUT:" cat $NAME.in
echo -e "\nOUTPUT:" timeout 2s ./$PROG < $NAME.in > $NAME.res case $? in 0) ;; 124) echo -e "TLE.\n" exit 124 ;; *) exit * ;; esac cat $NAME.res if [ -f $NAME.out ]; then echo -e "ANSWER:" cat $NAME.out echo -e "\nDIFF:" diff $NAME.res $NAME.out fi echo -e "\n___________________________________" echo -e "\n" done exit 0
|