#!/bin/bash
set -e

pkg=sickle
CUR_DIR=`pwd`

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

cp ${CUR_DIR}/test/* -a "${AUTOPKGTEST_TMP}"

cd "${AUTOPKGTEST_TMP}"
gunzip -r *

echo 'Test 1'
sickle se -f test.fastq -t illumina -o test1_output_file.fastq
sickle se -f test.f.fastq -t illumina -o test1_output_file.fastq -q 33 -l 40
sickle se -f test.r.fastq -t illumina -o test1_output_file.fastq -x -n
sickle se --fastq-file test.fastq --qual-type sanger --output-file test1_output_file.fastq
echo 'PASS'
echo

echo 'Test 2'
sickle pe -f test.fastq -r test.r.fastq -t sanger -o trimmed_output_file1.fastq -p trimmed_output_file2.fastq \
-s trimmed_singles_file.fastq -q 2 -l 15
echo 'PASS'

