From e59931beba52bcb8105b239980664b83a57a60de Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Sat, 25 Aug 2012 10:07:26 -0700 Subject: [PATCH] tests: amplitude --- tests/self-test | 6 +++--- tests/test-30-amplitude | 27 +++++++++++++++++++++++++++ tests/test-31-amplitude-float | 2 ++ 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100755 tests/test-30-amplitude create mode 100755 tests/test-31-amplitude-float diff --git a/tests/self-test b/tests/self-test index 9d2a969..ceed436 100755 --- a/tests/self-test +++ b/tests/self-test @@ -69,20 +69,20 @@ cmp "$textfile" $TMPF.out } < $TMPF.err -result="OK " +result="OK " exitcode=0 [ $test_perfect -eq 1 ] && { match="confidence=inf .* (rate perfect)" if grep -q "$match" $TMPF.err then - result="PERFECT " + result="PERFECT" else result="IMPERFECT" exitcode=1 fi } -echo -e "$result $stats" +echo -e "$result $stats" exit $exitcode diff --git a/tests/test-30-amplitude b/tests/test-30-amplitude new file mode 100755 index 0000000..40fd544 --- /dev/null +++ b/tests/test-30-amplitude @@ -0,0 +1,27 @@ +#!/bin/bash + +flags="1200 $*" + +let count=0 +let fail=0 + +function try_tx_rx_ampl +{ + a="$1" + echo -n "$a " + let count++ + ./self-test testdata-ascii.txt --volume $a $flags -- $flags || let fail++ +} + +for ampl in 3.50 1.00 0.30 0.01 " E " +do + try_tx_rx_ampl "$ampl" +done + +if [ $fail -eq 0 ] +then +echo " (all $count amplitude tests passed)" +else +echo " ($fail/$count amplitude tests failed)" +fi +exit $fail diff --git a/tests/test-31-amplitude-float b/tests/test-31-amplitude-float new file mode 100755 index 0000000..960c55d --- /dev/null +++ b/tests/test-31-amplitude-float @@ -0,0 +1,2 @@ +#!/bin/bash +exec ./test-30-amplitude --float