Created
February 20, 2017 03:20
-
-
Save venkr/bb70bf0d04c51bf8b21f8db8616dff7c to your computer and use it in GitHub Desktop.
CSE12 HW6 Checker
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 | |
#NOTE: This script must be in the src folder | |
#Modify classpath to include class directory, and link to JUnit jar if your tester is in there. | |
#If you don't want to go through the work of finding the JUnit jar, temporarily move your Testers outside | |
CLASSPATH="hw6:/Users/USERNAME/.p2/pool/plugins/org.junit_4.12.0.v201504281640/junit.jar" | |
#Modify these | |
#DIR refers to the directory relative to the script | |
DIR="hw6" | |
#PACK refers to the package in which your classes are | |
PACK="hw6" | |
#TESTS refers to the relative location of the test files | |
TESTS="../HW6 Tests" | |
#Compile the program | |
javac -cp $CLASSPATH "$DIR"/*.java | |
#Iterate over test cases | |
for i in 1 2 3 4 | |
do | |
#Diff the given output and your program's output | |
#-y makes it give a side-by-side view making it easier to read | |
diff=$(diff -y <(java "$PACK".CourseScheduling "$TESTS"/Information.txt "$TESTS"/Input$i.txt) "$TESTS"/ConsoleOutput$i.txt) | |
#If diff wasn't empty, then you can see the diff to see what was wrong | |
#This also stops execution, to prevent too much information from flooding you | |
if [ $? -eq 1 ]; then | |
echo "$diff" | |
break | |
#Else you should get a message telling you that everything is good! | |
else | |
echo $i is correct! | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment