#!/bin/bash
set -e
cd "$(dirname "$(realpath "$0")")"


PROJ="$(dirname "$PWD")"


if ! [ -f "$PROJ/venv/bin/activate" ]
then "$PROJ/setup.sh"
fi

. "$PROJ/venv/bin/activate"


rm -fr   output
mkdir -p output
cd output


function run() {
    src="$1"
    name="$(basename "$src")"
    (
        set +e
        python "$src" > "$name.log" 2>&1
        if [ "$?" = "0" ]
        then echo "OK  $name"
        else echo "ERR $name	'test/output/$name.log'"
        fi
        set -e
    ) || true
}


run "$PROJ/src/kripke.py"
run "$PROJ/src/GBA.py"
run "$PROJ/src/LTL.py"
run "$PROJ/src/LTLchecker.py"
run "$PROJ/src/LTLtoGBA.py"
run "$PROJ/src/product.py"
run "$PROJ/src/emptyTest.py"
