#! /bin/sh

### Set verbose mode
test "x$VERBOSE" = "xx" && set -x

### Set environnement
TOPPREDOPT=' -g none -t none'

### detect segment at the beginning of the sequence
base='first_seg'
/usr/bin/toppred $TOPPREDOPT ${base}.fasta >${base}_tmp.out 2>${base}_tmp.err || exit 1

diff ${base}_tmp.out ${base}.out >/dev/null || exit 1
diff ${base}_tmp.err ${base}.err >/dev/null || exit 1

### detect segment at the end of the sequence
base='last_seg'
/usr/bin/toppred $TOPPREDOPT ${base}.fasta >${base}_tmp.out 2>${base}_tmp.err || exit 1

diff ${base}_tmp.out ${base}.out >/dev/null || exit 1
diff ${base}_tmp.err ${base}.err >/dev/null || exit 1

### no segment found
base='no_seg'
/usr/bin/toppred $TOPPREDOPT ${base}.fasta >${base}_tmp.out 2>${base}_tmp.err || exit 1

diff ${base}_tmp.out ${base}.out >/dev/null || exit 1
diff ${base}_tmp.err ${base}.err >/dev/null || exit 1

exit 0
