#!/bin/sh -e

pkgname=fitdistrplus
debname=r-cran-fitdistrplus

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 testfile in *.R; do
    if grep -qw actuar $testfile ; then
        echo "SKIP TEST $testfile since r-cran-actuar is not yet available"
        continue
    fi
    if grep -qw GeneralizedHyperbolic $testfile ; then
       echo "SKIP TEST $testfile since r-cran-GeneralizedHyperbolic is not yet available"
       continue
    fi
    if grep -qw mc2d $testfile ; then
       echo "SKIP TEST $testfile since r-cran-mc2d is not yet available"
       continue
    fi
    echo "BEGIN TEST $testfile"
    LC_ALL=C.UTF-8 R --no-save < $testfile 2>/dev/null > /dev/null
    echo "$testfile ..... $?"
done

