#!/usr/bin/env bash

JUNITPATH="/libs/junit5.jar"

if [[ -f ${JUNITPATH} ]]; then
    cp ${JUNITPATH} ../
fi

if ! javac -cp ../junit5.jar:. *.java; then
    echo
    echo "Submission Failed Check: cannot compile IterableRedBlackTree.java or P106InterfaceIntegrityChecker.java"
    exit 1
fi

if ! java -jar ../junit5.jar --class-path=. --select-class=P106SubmissionChecker; then
    echo
    echo "Submission Failed Check: one or more JUnit tests failed; if you have completed the P106 assignment up until and including step 4 and the testNonNullIterator test passes, you have completed all the work required by the midweek deadline."
    exit 1
fi

echo
echo "Submission Passed Basic Scan"
exit 0
