#!/bin/sh

set -e

indir=debian/tests/why
outdir=${TMPDIR-/tmp}

# alt-ergo cannot prove the VC of racine :-(
for infile in $indir/minimum.why $indir/gauss.why
do
    base=$(basename $infile)
    echo "Testing why + alt-ergo on $base" >&2
    whyoutfile=$outdir/${base%.why}_why.why
    altoutfile=$outdir/${base%.why}.ae
    why --alt-ergo --output $whyoutfile $infile
    alt-ergo $whyoutfile > $altoutfile
    if $(grep -qv "Valid" $altoutfile); then
	cat $altoutfile
	exit 1
    fi
done