From fa9070cbea09a3daf33463a39da8eef6f10664df Mon Sep 17 00:00:00 2001 From: Rob Sykes Date: Tue, 8 Mar 2016 20:11:04 +0000 Subject: [PATCH] enhance tests --- tests/io-test | 2 +- tests/time-test | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/io-test b/tests/io-test index 5b1a613..0972f38 100755 --- a/tests/io-test +++ b/tests/io-test @@ -23,7 +23,7 @@ zs=(180 180 180 180 180 120 120 120 120) do_one() { it=${types[$1]}; ot=${types[`expr $2 % 4 || true`]} $tool $ir $or $c $1 $2 $3 < $c.$it > a.$ot - sox -r $or -c $c a.$ot -n spectrogram -X50 -hw$w -z${zs[$n]} -o io$c$n$w.png -c "io-test i:$it o:$ot ($2) q:$3" + sox -r $or -c $c a.$ot -n spectrogram -X50 -hw$w -z${zs[$n]} -o io$c$n-$w.png -c "io-test i:$it o:$ot ($2) q:$3" ./4-split-channels $ir $or $c $1 $2 $3 < $c.$it > b.$ot [ $2 != 3 ] && cmp a.$ot b.$ot || test $(sox -mv-1 -r$or -c$c a.$ot -r$or -c$c b.$ot -n stats 2>&1 |grep Pk\ l|tr ' ' '\n'|grep '[0-9]'|uniq) = -84.29 diff --git a/tests/time-test b/tests/time-test index bbc2cd5..0385d00 100755 --- a/tests/time-test +++ b/tests/time-test @@ -8,9 +8,8 @@ set -e tool=./3-options-input-fn ext=f32; e=0 -test z$1 != z && c=$1 || c=2 -qs="`seq 0 7`" -qv="4 20" +test z"$1" != z && c="$1" || c=2 +test z"$2" != z && qs="$2" || qs="`seq 0 7` v" rates="48000 77773 96000" time=`which time` BASE=`basename $0` @@ -23,9 +22,9 @@ for rate0 in $rates; do rate2=$rate0 for n in 1 2; do sox -R -r $rate1 -n -c $c 0.$ext synth $len noise; sync - for q in $qs "$qv"; do - $time -f %e -o $TIME $tool $rate1 $rate2 $c $e $e $q < 0.$ext > /dev/null 2> $ERR - [ "$q" == "4 20" ] && q=v + for q in $qs; do + test $q = v && Q="4 20" || Q=$q + $time -f %e -o $TIME $tool $rate1 $rate2 $c $e $e $Q < 0.$ext > /dev/null 2> $ERR echo $rate1 '-->' $rate2 c=$c q=$q t=`cat $TIME` `cat $ERR | sed 's/.*(/(/'` done rate1=$rate0