#!/bin/bash

echo "Running test for issue 2 (inside relationship mapping)..."

pip install virtualenv
virtualenv .venv
source .venv/bin/activate
pip install beautifulsoup4==4.9.2

# RZ -- need to set LgEvalDir and PYTHONPATH for
# this to work.
#
# NOTE: These definitions are lost after the 
# script ends (they are associated only with the
# invoked process that the shell program runs in)
#
# NOTE 2: You *must* use export to define a variable
# that you want to be visible in child processes
# (e.g., where lg2mml is called below)
export LgEvalDir=`cd ../..; pwd`
export PYTHONPATH=`cd ../../../; pwd`/
export PATH=$LgEvalDir/bin:$PATH

echo "  LgEvalDir    $LgEvalDir"
echo "  PYTHONPATH   $PYTHONPATH"
echo "  PATH         $PATH"
echo ""

TEST_FILES=`ls ../../tests/sqrt_lg/*.lg` 
for file in $TEST_FILES
do
  lg2mml ../../tests/sqrt_lg/$file
  filename=`basename $file .lg`
  echo MathML generated: "$filename".mml
done

deactivate