--- /dev/null
+SEQ: CTAGCTTCGACT
+SEQ_LEN: 12
+SEQ_NAME: test1
+---
+SEQ: GAATCGACT
+SEQ_LEN: 9
+SEQ_NAME: test2
+---
+SEQ: ACGAAACTAGCATC
+SEQ_LEN: 14
+SEQ_NAME: test3
+---
+SEQ: AGCATCGACT
+SEQ_LEN: 10
+SEQ_NAME: test4
+---
+SEQ: TAACAGGCACT
+SEQ_LEN: 11
+SEQ_NAME: test5
+---
--- /dev/null
+SEQ_NAME: test1
+SEQ_LEN: 10
+SEQ: MDESEQATHP
+---
+SEQ_NAME: test2
+SEQ_LEN: 8
+SEQ: ATCGatcg
+---
+PAT_NAME: test2
+PAT: SEQ
+---
+COUNT: 3
+---
--- /dev/null
+SEQ
+COUNT
--- /dev/null
+>test1
+ATCG
+>test2
+atcg
--- /dev/null
+SEQ: ATCGatcg
+SEQ_LEN: 8
+SEQ_NAME: test
+---
--- /dev/null
+#!/usr/bin/env sh
+
+bp=`basename $0 | sed s/^test_//`
+in="$BP_DIR/bp_test/in/$bp.in"
+out="$BP_DIR/bp_test/out/$bp.out"
+tmp="$BP_TMP/$bp.out"
+log_file="$BP_TMP/test.log"
+
+function run
+{
+ local command=$1
+
+ echo -n "Testing $command ... "
+ eval $command > /dev/null 2>&1
+}
+
+
+function assert_no_diff
+{
+ local src=$1
+ local dst=$2
+
+ local diff=`diff -q $src $dst`
+
+ if [ "$diff" != "" ]; then
+ echo_red "FAIL"
+ echo "FAIL" >> $log_file
+ else
+ echo_green "OK"
+ echo "OK" >> $log_file
+ fi
+}
+
+
+function echo_green
+{
+ local msg=$1
+
+ echo -e "\033[32;38m$msg\033[0m"
+}
+
+function echo_red
+{
+ local msg=$1
+
+ echo -e "\033[31;38m$msg\033[0m"
+}
--- /dev/null
+SEQ: ---TAACAGGCACT
+SEQ_LEN: 14
+SEQ_NAME: test5
+---
+SEQ: -----GAATCGACT
+SEQ_LEN: 14
+SEQ_NAME: test2
+---
+SEQ: --CTAGCTTCGACT
+SEQ_LEN: 14
+SEQ_NAME: test1
+---
+SEQ: ACGAAACTAGCATC
+SEQ_LEN: 14
+SEQ_NAME: test3
+---
+SEQ: ----AGCATCGACT
+SEQ_LEN: 14
+SEQ_NAME: test4
+---
--- /dev/null
+SEQ: MDESEQATHP
+SEQ_LEN: 10
+SEQ_NAME: test1
+---
+SEQ: ATCGatcg
+SEQ_LEN: 8
+SEQ_NAME: test2
+---
+PAT: SEQ
+PAT_NAME: test2
+---
--- /dev/null
+SEQ: ATCGatcg
+SEQ_LEN: 8
+SEQ_NAME: test2
+---
--- /dev/null
+SEQ: MDESEQATHP
+SEQ_LEN: 10
+SEQ_NAME: test1
+---
+SEQ: ATCGatcg
+SEQ_LEN: 8
+SEQ_NAME: test2
+---
+PAT: SEQ
+PAT_NAME: test2
+---
+COUNT: 3
+---
--- /dev/null
+SEQ: MDESEQATHP
+SEQ_LEN: 10
+SEQ_NAME: test1
+---
+SEQ: ATCGatcg
+SEQ_LEN: 8
+SEQ_NAME: test2
+---
+PAT: SEQ
+PAT_NAME: test2
+---
+COUNT: 3
+---
--- /dev/null
+COUNT: 3
+---
--- /dev/null
+SEQ: MDESEQATHP
+SEQ_LEN: 10
+SEQ_NAME: test1
+---
+SEQ: ATCGatcg
+SEQ_LEN: 8
+SEQ_NAME: test2
+---
--- /dev/null
+SEQ: MDESEQATHP
+SEQ_LEN: 10
+SEQ_NAME: test1
+---
+PAT: SEQ
+PAT_NAME: test2
+---
--- /dev/null
+PAT: SEQ
+PAT_NAME: test2
+---
--- /dev/null
+SEQ: ATCGatcg
+SEQ_LEN: 8
+SEQ_NAME: test2
+---
--- /dev/null
+SEQ: MDESEQATHP
+SEQ_LEN: 10
+SEQ_NAME: test1
+---
+SEQ: ATCGatcg
+SEQ_LEN: 8
+SEQ_NAME: test2
+---
--- /dev/null
+SEQ: ATCG
+SEQ_LEN: 4
+SEQ_NAME: test1
+---
+SEQ: atcg
+SEQ_LEN: 4
+SEQ_NAME: test2
+---
--- /dev/null
+SEQ: ATCG
+SEQ_LEN: 4
+SEQ_NAME: test1
+---
--- /dev/null
+>test
+ATCGatcg
--- /dev/null
+>test
+ATCG
+atcg
--- /dev/null
+#!/usr/bin/env sh
+
+source "lib/test.sh"
+
+run "$bp -I $in -O $tmp.1"
+assert_no_diff $tmp.1 $out.1
+rm $tmp.1
--- /dev/null
+#!/usr/bin/env sh
+
+source "lib/test.sh"
+
+run "$bp -I $in -p SEQ -O $tmp.1"
+assert_no_diff $tmp.1 $out.1
+rm $tmp.1
+
+run "$bp -I $in -p SEQ,COUNT -O $tmp.2"
+assert_no_diff $tmp.2 $out.2
+rm $tmp.2
+
+run "$bp -I $in -P $in.pat -O $tmp.3"
+assert_no_diff $tmp.3 $out.3
+rm $tmp.3
+
+run "$bp -I $in -p SEQ -i -O $tmp.4"
+assert_no_diff $tmp.4 $out.4
+rm $tmp.4
+
+run "$bp -I $in -p SEQ -K -O $tmp.5"
+assert_no_diff $tmp.5 $out.5
+rm $tmp.5
+
+run "$bp -I $in -p SEQ -V -O $tmp.6"
+assert_no_diff $tmp.6 $out.6
+rm $tmp.6
+
+run "$bp -I $in -p SEQ -k PAT -O $tmp.7"
+assert_no_diff $tmp.7 $out.7
+rm $tmp.7
+
+run "$bp -I $in -r a -k SEQ -O $tmp.8"
+assert_no_diff $tmp.8 $out.8
+rm $tmp.8
+
+run "$bp -I $in -r a -k SEQ -c -O $tmp.9"
+assert_no_diff $tmp.9 $out.9
+rm $tmp.9
+
+run "$bp -I $in -e 'SEQ_LEN<10' -O $tmp.10"
+assert_no_diff $tmp.10 $out.10
+rm $tmp.10
--- /dev/null
+#!/usr/bin/env sh
+
+source "lib/test.sh"
+
+run "$bp -i $in -O $tmp.1"
+assert_no_diff $tmp.1 $out.1
+rm $tmp.1
+
+run "$bp -i $in -n 1 -O $tmp.2"
+assert_no_diff $tmp.2 $out.2
+rm $tmp.2
--- /dev/null
+#!/usr/bin/env sh
+
+source "lib/test.sh"
+
+run "write_fasta -I $in -o $tmp.1 -x"
+assert_no_diff $tmp.1 $out.1
+rm $tmp.1
+
+run "write_fasta -I $in -w 4 -o $tmp.2 -x"
+assert_no_diff $tmp.2 $out.2
+rm $tmp.2
--- /dev/null
+#!/usr/bin/env sh
+
+source "lib/test.sh"
+
+rm $log_file
+
+count=0
+time0=`date +%s`
+
+for i in `ls "$BP_DIR/bp_test/test/"`; do
+ "$BP_DIR/bp_test/test/$i"
+ count=$[ $count + 1 ]
+done
+
+time1=`date +%s`
+time=$[ $time1 - $time0 ]
+
+test_count=`cat $log_file | wc -l | sed "s/ //g"`
+test_ok=`grep -c "OK" $log_file`
+
+test_fail=$[ $test_count - $test_ok ]
+
+report="Biopieces tested: $count Tests run: $test_count OK: $test_ok FAIL: $test_fail Time: $time secs"
+
+if [ $test_fail = 0 ]; then
+ echo_green "$report"
+else
+ echo_red "$report"
+fi