#!/bin/bash
set -e

CUR_DIR=`pwd`
export LC_ALL=C.UTF-8
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 ${CUR_DIR}/testData/* .

echo "Testing C binary"
alleleCounter -l test10X.loci -b test10X.bam -o test1 -m 2 -r test10X.bam.bai
echo "PASS"

echo "Test Perl counterpart"
alleleCounter.pl -l test10X.loci -b test10X.bam -o test2 -m 2 -r test10X.bam.bai
echo "PASS"

echo "Check if both are same"
diff -u test1 test2
rm -f ./test1 ./test2
echo "PASS"

