Skip to content

Instantly share code, notes, and snippets.

@Sorebit
Created November 6, 2016 16:39
Show Gist options
  • Save Sorebit/f758d1754cd7ca2fcf8ebfebdf0119c6 to your computer and use it in GitHub Desktop.
Save Sorebit/f758d1754cd7ca2fcf8ebfebdf0119c6 to your computer and use it in GitHub Desktop.
Sprawdzarka
#!/bin/bash
DIR="tests"
PRG="./app"
DIFPRG=diff
# Colordiff jeśli jest, inaczej diff
if hash colordiff 2>/dev/null; then
DIFPRG=colordiff
fi
# Weź wszystkie pliki z katalogu $DIR
for inp in $DIR/*.in; do
# Zmień wszystkie "in" w nazwie na "out"
out=$(echo $inp | sed 's/in/out/g')
# Wypisz numer testu
echo -en "\r$inp"
# Sprawdzanie TLE
#(sleep 6; killall $program &>/dev/null && echo "TLE!")&
# Testuj
j1=$($PRG < $inp)
# Jesli nie wystąpił crash
if [ $? -eq 0 ]; then
$DIFPRG -u --ignore-all-space <(echo "$j1" ) $out
if [ $? -gt 0 ]; then
bledy=$((bledy+1));
fi
# Sprawdzanie TLE
# killall sleep;
else
echo "Program crashed"
exit
fi
sleep 0.01;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment