#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

JAVA="java -cp pa1-tests/chocopy-ref.jar:target/assignment.jar chocopy.ChocoPy"

echo "# CORE TESTS"
${JAVA} --pass=s --test --dir pa1-tests/core

echo
echo "# EXTRA TESTS"
${JAVA} --pass=s --test --dir pa1-tests/extra

echo
echo "# STUDENT TESTS"
function regen_ast_and_test {
  ${JAVA} --pass=r "${1}" --out "${1}.ast" 2>/dev/null 1>&2
  ${JAVA} --pass=s --test "${1}"
}
regen_ast_and_test src/test/data/pa1/student_contributed/good.py
regen_ast_and_test src/test/data/pa1/student_contributed/bad.py
