#!/bin/sh -e

pkg=mapdamage

if [ "$AUTOPKGTEST_TMP" = "" ] ; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
  trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi

cd $AUTOPKGTEST_TMP

cp -a /usr/lib/python3/dist-packages/mapdamage/tests .
cp /usr/lib/python3/dist-packages/mapdamage/mp_test.py .
python3 mp_test.py

exit 0

cp -a /usr/share/doc/${pkg}/ref_T.fa .
gunzip -r *

# these old test so not work any more since rescale_test/ was removed upstream

mapDamage -i rescale_test/pe_test/pe.sam -r ref_T.fa
pdf_result="results_pe/Fragmisincorporation_plot.pdf"

if [ -e "$pdf_result" ]; then
   echo "pdf result exists"
else
   echo "pdf result doesnt' exist"
   exit 1
fi

mapDamage -d results_pe -y 0.1 --plot-only

echo "checking stdin redirect..."
cat rescale_test/pe_test/pe.sam | mapDamage -i - -r ref_T.fa

rm -rf results_pe
mapDamage -i rescale_test/pe_test/pe.sam -r ref_T.fa --rescale

mapDamage -d results_pe --forward --stats-only -v -r ref_T.fa
#asks for -r reference when it's not mentioned in examples


