#!/bin/sh

set -e

F77=gfortran
top_srcdir=${PWD}

cd ${AUTOPKGTEST_TMP}

for t in test testw testdo testsw testdf ; do
  ratfor -o ${t}.f ${top_srcdir}/${t}.r
  ${F77} ${t}.f ${FFLAGS} -o ${t}
  ./${t} > ${t}.out
  diff -u ${t}.out ${top_srcdir}/${t}.std
  rm -f ${t} ${t}.f ${t}.out
done

ratfor -C ${top_srcdir}/testcl.r | sed 1d > testcl-C.f
diff -u testcl-C.f ${top_srcdir}/testcl-C.f.std
rm -f testcl-C.f
ratfor -l 500 ${top_srcdir}/testcl.r | sed 1d > testcl-l500.f
diff -u testcl-l500.f ${top_srcdir}/testcl-l500.f.std
rm -f testcl-l500.f
