diff --git a/tests/test-80-SAME-datastream b/tests/test-80-SAME-datastream new file mode 100755 index 0000000..5289670 --- /dev/null +++ b/tests/test-80-SAME-datastream @@ -0,0 +1,55 @@ +#!/bin/bash + +MINIMODEM="${MINIMODEM-./minimodem}" +[ -f "$MINIMODEM" ] || { + MINIMODEM="../src/minimodem" + [ -f "$MINIMODEM" ] || { + echo "E: cannot find minimodem in ./ or ../src/" 1>&2 + exit 1 + } +} + + +teststring="Testing 0 1 2 3 4. This is only a test. Testing 5 6 7 8 9. This is only a test." +[ "$1" != "" ] && teststring="$1" + + +TMPF="/tmp/minimodem-test-$$" +trap "rm -f $TMPF.*" 0 + +set -e + +minimodem_tx_args="SAME" +minimodem_rx_args="SAME" + + +# insert the 0xAB SAME sync byte to simulate the start of a SAME +# protocol bytestream. +printf "JUNK\\xAB${teststring}" \ +| $MINIMODEM --tx --file $TMPF.wav $minimodem_tx_args + +# cp $TMPF.wav /tmp/x.wav + +$MINIMODEM --rx --file $TMPF.wav $minimodem_rx_args \ + > $TMPF.out 2> $TMPF.err || { + cat $TMPF.err + exit 1 +} + +# printf "$teststring" | cmp - $TMPF.out +printf "$teststring" | diff - $TMPF.out + +{ + read xlitcarrier + read xlitblankline + read xlithashes xlitnocarrier stats + stats="${stats% ###}" +} < $TMPF.err + + +result="OK " +exitcode=0 + +echo -e "$result $stats" + +exit $exitcode