#!/bin/sh -e

pkgname=parameters
debname=r-cran-parameters

if [ "$AUTOPKGTEST_TMP" = "" ] ; then
    AUTOPKGTEST_TMP=`mktemp -d /tmp/${debname}-test.XXXXXX`
    trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi
cd $AUTOPKGTEST_TMP
cp -a /usr/share/doc/$debname/tests/* $AUTOPKGTEST_TMP
gunzip -r *

# For the moment tests requiring EGAnet are excluded.
# This package requires a quite extensive list of rdepends
# which make a lot of effort to package and to maintain
# So for the moment these two tests are just removed
find . -name test-n_factors.R -delete
find . -name test-pca.R -delete
find . -name test-model_parameters.blmerMod.R -delete

for testfile in *.R; do
    echo "BEGIN TEST $testfile"
    LC_ALL=C.UTF-8 R --no-save < $testfile
done

