#!/bin/bash

# regression test  (need to run regrtest -ocaml in ../elsa before)
#
# run ast_graph and dot on all ast files found
#
# takes a long time because doing graph layout with dot is time consuming
# to improve to timings you can patch dot to exit after parsing the dot file
# call this dot-parseonly, place it into the PATH and use the option -parse


trap "echo Interupted; exit 1" SIGINT

# load variable ast-files
. regtest-ast-files

function usage(){
    echo "usage: regtest-files"
    exit 1
}

find ../elsa/in -name \*.oast -print | sort > output-find 2>&1
echo $ast_files | tr ' ' '\n' | sort > output-var

diff output-find output-var
result=$?
if [ $result -eq 0 ] ; then
    echo test passed
    rm -f output-find output-var
else
    echo test failed
fi
