diff options
Diffstat (limited to 'tests/test_all_formats.sh')
-rwxr-xr-x | tests/test_all_formats.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/test_all_formats.sh b/tests/test_all_formats.sh new file mode 100755 index 0000000..6da27af --- /dev/null +++ b/tests/test_all_formats.sh @@ -0,0 +1,62 @@ +#!/bin/sh + + +# This script generates test data for all formats by doing the +# following: +# * encode the user-specified PCM file into each format +# * re-decode that format back to PCM +# +# Use this to generate test files that are to be shipped together with +# gapk. Always use the + + +# directory in which the temporary output is stored +OUTDIR=/tmp + +# name of the input s16le file to use for encoding and re-decoding +INFILE=$1 + +# source some common parameters +. ./common.sh + +RETVAL=0 + +for f in $FORMATS; do + BASE=`basename $INFILE` + OUTFILE=$OUTDIR/$BASE.$f + echo Format $f: Encoding $INFILE to $OUTFILE + $GAPK -f rawpcm-s16le -i $INFILE -g $f -o $OUTFILE + + # compare with reference + diff $OUTFILE $REFDIR/`basename $OUTFILE` + if [ $? -ne 0 ]; then + echo "===> FAIL" + RETVAL=1 + else + echo "===> PASS" + fi + echo + + DECFILE=$OUTFILE.s16 + echo Format $f: Decoding $OUTFILE to $DECFILE + $GAPK -f $f -i $OUTFILE -g rawpcm-s16le -o $DECFILE + + # compare with reference + diff $DECFILE $REFDIR/`basename $DECFILE` + if [ $? -ne 0 ]; then + echo "===> FAIL" + RETVAL=1 + else + echo "===> PASS" + fi + echo +done + +echo -n "Overall Verdict: " +if [ $RETVAL -ne 0 ]; then + echo "FAIL" +else + echo "PASS" +fi + +exit $RETVAL |