summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2011-10-28 12:09:00 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2011-10-28 12:09:00 -0400
commitad20dd2f4313747f187622e6c7bf4fcfe1a98f77 (patch)
tree9b694a513d3cecc32313642884cdce288e025373 /tests
parentd84fa9fd6eb96202f5721ae3ce6410d1cbb19f96 (diff)
downloadopus-ad20dd2f4313747f187622e6c7bf4fcfe1a98f77.tar.gz
Preparing for test vectors
Diffstat (limited to 'tests')
-rwxr-xr-xtests/run_vectors.sh89
1 files changed, 89 insertions, 0 deletions
diff --git a/tests/run_vectors.sh b/tests/run_vectors.sh
new file mode 100755
index 00000000..c54c309f
--- /dev/null
+++ b/tests/run_vectors.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+CMD_PATH=$1
+VECTOR_PATH=$2
+
+OPUS_DEMO=$CMD_PATH/opus_demo
+OPUS_COMPARE=$CMD_PATH/opus_compare
+
+if [ -d $VECTOR_PATH ]; then
+ echo Test vectors found in $VECTOR_PATH
+else
+ echo No test vectors found
+ #Don't make the test fail here because the test vectors will be
+ #distributed separateyl
+ exit 0
+fi
+
+if [ -x $OPUS_DEMO ]; then
+ echo Decoding with $OPUS_DEMO
+else
+ echo ERROR: Decoder not found: $OPUS_DEMO
+ exit 1
+fi
+
+echo "=============="
+echo Testing mono
+echo "=============="
+echo
+
+for file in test1_mono
+do
+ if [ -e $VECTOR_PATH/$file.bit ]; then
+ echo Testing $file
+ else
+ echo Bitstream file not found: $file
+ fi
+ if $OPUS_DEMO -d 48000 1 $VECTOR_PATH/$file.bit tmp.out > /dev/null 2>&1; then
+ echo successfully decoded
+ else
+ echo ERROR: decoding failed
+ exit 1
+ fi
+ $OPUS_COMPARE $VECTOR_PATH/$file.float tmp.out > /dev/null 2>&1
+ float_ret=$?
+ $OPUS_COMPARE $VECTOR_PATH/$file.fixed tmp.out > /dev/null 2>&1
+ fixed_ret=$?
+ if [ "$float_ret" -eq "0" -o "$fixed_ret" -eq "0" ]; then
+ echo output matches reference
+ else
+ echo ERROR: output does not match reference
+ exit 1
+ fi
+ echo
+done
+
+echo "=============="
+echo Testing stereo
+echo "=============="
+echo
+
+for file in test1_stereo
+do
+ if [ -e $VECTOR_PATH/$file.bit ]; then
+ echo Testing $file
+ else
+ echo Bitstream file not found: $file
+ fi
+ if $OPUS_DEMO -d 48000 2 $VECTOR_PATH/$file.bit tmp.out > /dev/null 2>&1; then
+ echo successfully decoded
+ else
+ echo ERROR: decoding failed
+ exit 1
+ fi
+ $OPUS_COMPARE -s $VECTOR_PATH/$file.float tmp.out > /dev/null 2>&1
+ float_ret=$?
+ $OPUS_COMPARE -s $VECTOR_PATH/$file.fixed tmp.out > /dev/null 2>&1
+ fixed_ret=$?
+ if [ "$float_ret" -eq "0" -o "$fixed_ret" -eq "0" ]; then
+ echo output matches reference
+ else
+ echo ERROR: output does not match reference
+ exit 1
+ fi
+ echo
+done
+
+
+
+echo All tests have passed successfully