Skip to content

Instantly share code, notes, and snippets.

@lepiku
Last active December 10, 2019 13:17
Show Gist options
  • Save lepiku/58cee25affab7c8b59d3ae4562fc7b50 to your computer and use it in GitHub Desktop.
Save lepiku/58cee25affab7c8b59d3ae4562fc7b50 to your computer and use it in GitHub Desktop.
Autorun Alghi Testcases

Cannot run in CMD, run it on GIT BASH or LINUX/MAC terminal

  • Download alghi testcases from here.
  • Download the test: testcases.bash
  • Put all tests, testcases.bash, and the '.java' file in the same folder.
  • Run the test: In Linux/Mac terminal or git bash:
    bash testcases.bash
  • The diff shows if something is different:
    img different
    for example, in Testcase 3 on operation number 6 is wrong.
  • If nothing is different, it looks like this:
    img same
  • Check your user time to see if it's a timelimit error
javac TP4.java -d ./ # change 'TP4.java' to your java file
# use -d option to compile to current directory
for i in {1..25}; do
echo "Testcase $i"
java TP4 < "in$i" > "my$i" # also change 'TP4' to your class name
time diff --strip-trailing-cr "my$i" "out$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment