Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qef #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added err-output.txt
Empty file.
43 changes: 39 additions & 4 deletions grade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,44 @@ mkdir grading-area
git clone $1 student-submission
echo 'Finished cloning'

if [[ -f student-submission/ListExamples.java ]]
then
echo 'file found'
else
echo 'file not found'
exit 1
fi

# Draw a picture/take notes on the directory structure that's set up after
# getting to this point
cp student-submission/ListExamples.java grading-area
cp TestListExamples.java grading-area
cp -r lib grading-area

# Then, add here code to compile and run, and do any post-processing of the
# tests
javac -cp $CPATH grading-area/*.java 2> err-output.txt
if [[ $? != 0 ]]
then
echo 'compile error'
exit 1
fi

java -cp .:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar org.junit.runner.JUnitCore grading-area/TestListExamples > junit-out.txt

FAILURES1=`grep -c "Failures: 1" junit-out.txt`
FAILURES2=`grep -c "Failures: 2" junit-out.txt`
FAILURES3=`grep -c "Failures: 3" junit-out.txt`
FAILURES4=`grep -c "Failures: 4" junit-out.txt`

if [[ $FAILURES1 -eq 1 ]]
then
echo 'Score 3/4'
elif [[ $FAILURES2 -eq 1 ]]
then
echo 'Sore 2/4'
elif [[ $FAILURES3 -eq 1 ]]
then
echo 'Score 1/4'
elif [[ $FAILURES4 -eq 1 ]]
then
echo 'Score 0/4'
else
echo 'Score 4/4, all test passed!'
fi
23 changes: 23 additions & 0 deletions junit-out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
JUnit version 4.13.2
.E
Time: 0
There was 1 failure:
1) initializationError(org.junit.runner.JUnitCommandLineParseResult)
java.lang.IllegalArgumentException: Could not find class [grading-area/TestListExamples]
at org.junit.runner.JUnitCommandLineParseResult.parseParameters(JUnitCommandLineParseResult.java:100)
at org.junit.runner.JUnitCommandLineParseResult.parseArgs(JUnitCommandLineParseResult.java:50)
at org.junit.runner.JUnitCommandLineParseResult.parse(JUnitCommandLineParseResult.java:44)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:72)
at org.junit.runner.JUnitCore.main(JUnitCore.java:36)
Caused by: java.lang.ClassNotFoundException: grading-area/TestListExamples
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:495)
at java.base/java.lang.Class.forName(Class.java:474)
at org.junit.internal.Classes.getClass(Classes.java:42)
at org.junit.internal.Classes.getClass(Classes.java:27)
at org.junit.runner.JUnitCommandLineParseResult.parseParameters(JUnitCommandLineParseResult.java:98)
... 4 more

FAILURES!!!
Tests run: 1, Failures: 1