comparison tests/test-transforms-basic/test-transforms-basic.sh @ 119:7a31201dc42d test-reorg

Split out tests into individual directories, with simpler naming therein
author Chris Cannam
date Wed, 08 Oct 2014 15:08:57 +0100
parents tests/test-transforms-basic.sh@0fe5abb56a6e
children 5200446bbc6b
comparison
equal deleted inserted replaced
118:0fe5abb56a6e 119:7a31201dc42d
1 #!/bin/bash
2
3 . ../include.sh
4
5 infile=$audiopath/3clicks8.wav
6 tmpfile1=$mypath/tmp_1_$$
7 tmpfile2=$mypath/tmp_2_$$
8
9 trap "rm -f $tmpfile1 $tmpfile2" 0
10
11 $r --skeleton $percplug > $tmpfile1 2>/dev/null || \
12 fail "Fails to run with --skeleton $percplug"
13
14 $r -t $tmpfile1 -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
15 fail "Fails to run with -t $tmpfile1 -w csv --csv-stdout $infile"
16
17 csvcompare $tmpfile2 $mypath/expected/skeleton-1.csv || \
18 faildiff "Output mismatch for skeleton-1.csv" $tmpfile2 $mypath/expected/skeleton-1.csv
19
20 for suffix in \
21 -no-parameters-default-output \
22 -no-parameters \
23 "" \
24 -start-and-duration \
25 -set-parameters \
26 -set-step-and-block-size \
27 -set-sample-rate \
28 -df-windowtype-default \
29 -df-windowtype-hanning \
30 -df-windowtype-hamming \
31 -df-start-and-duration \
32 -multiple-outputs \
33 -multiple-outputs-start-and-duration \
34 ; do
35
36 for type in xml n3 ; do
37
38 transform=$mypath/transforms/percussiononsets$suffix.$type
39 expected=$mypath/expected/percussiononsets$suffix.csv
40
41 if [ ! -f $transform ]; then
42 if [ $type = "xml" ]; then
43 continue # not everything can be expressed in the XML
44 # format, e.g. the multiple output test can't
45 fi
46 fi
47
48 test -f $transform || \
49 fail "Internal error: no transforms file for suffix $suffix (looking for $transform)"
50
51 test -f $expected || \
52 fail "Internal error: no expected output file for suffix $suffix (looking for $expected)"
53
54 $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
55 fail "Fails to run transform $transform"
56
57 csvcompare $tmpfile2 $expected || \
58 faildiff "Output mismatch for transform $transform" $tmpfile2 $expected
59 done
60 done
61
62 exit 0
63