Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

ListExamples.java is compiling but not the rest of .java files; $count is also not working #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
39 changes: 38 additions & 1 deletion grade.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
CPATH='.:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar'
CHECKEDFILE='ListExamples.java'

rm -rf student-submission
git clone $1 student-submission
echo 'Finished cloning'

echo 'Finished cloning...'

cd student-submission

if [[ -f $CHECKEDFILE ]]
then
echo $CHECKEDFILE 'found!'
else
echo 'error:' $CHECKEDFILE 'not found.'
exit
fi

echo '/////'

javac $CHECKEDFILE

if [[ $? -ne 0 ]]
then
echo 'error:' $CHECKEDFILE 'did not compile'
exit

else
echo $CHECKEDFILE 'compiles!'
fi

cd ..

cp student-submission/ListExamples.java ./

javac -cp ".;lib/hamcrest-core-1.3.jar;lib/junit-4.13.2.jar" *.java
echo 'compiling JUnit...'
java -cp ".;lib/junit-4.13.2.jar;lib/hamcrest-core-1.3.jar" org.junit.runner.JUnitCore TestListExamples.java

count=$(java -cp . ListExamples)

echo $? 'out of' $count 'tests passed'