#!/bin/bash

FILENAME=$1

if [ -z "$1" ] ; then
    echo "Usage for individual test cases: test.sh FILEPATH, where FILEPATH is the location of the python file"
    exit 1
fi

echo "Testing file ${FILENAME}"

echo "Generating .ast.typed file using student parser and reference analyzer"
java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=sr \
  ${FILENAME} --out=${FILENAME}.ast.typed

echo "Comparing the pervious output with student parser and student analyzer"
java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy \
  --pass=ss --test ${FILENAME}
