set -e
INPUT=testdata/four_reads.pe.fastq;
lots_of_reads=$(for i in $(seq 1 100); do cat $INPUT; done;);
random_reads=$(echo "$lots_of_reads" | ./target/debug/friends_phoebe)
random_pe_reads=$(echo "$lots_of_reads" | ./target/debug/friends_phoebe --paired-end)
random_sorted=$(echo "$random_reads" | sort)
random_pe_sorted=$(echo "$random_pe_reads" | sort)
reads_sorted=$(echo "$lots_of_reads" | sort)
if [ "$random_sorted" != "$reads_sorted" ]; then
echo "ERROR: did not get the same reads out as I fed them to the random reads script"
exit 1
fi
if [ "$random_pe_sorted" != "$reads_sorted" ]; then
echo "ERROR: did not get the same PE reads out as I fed them to the random reads script"
exit 1
fi
if [ "$random" == "$(cat $INPUT)" ]; then
echo "WARNING: random reads look like they are in the same order as the original file"
echo "If you think that you got this result by chance, please run this test one more time."
exit 1
fi
echo "$random_pe_reads" | ./target/debug/friends_ung
echo "$0 passed!"