comparison tests/test-jams-writer/test-jams-writer.sh @ 204:1f8fef5c6ea2

Add digits option to JAMS output, for number of sig figs
author Chris Cannam
date Tue, 03 Nov 2015 11:36:24 +0000
parents f35bbb3e4d41
children c17b184c16db
comparison
equal deleted inserted replaced
203:08d492f861e9 204:1f8fef5c6ea2
3 . ../include.sh 3 . ../include.sh
4 4
5 tmpjson=$mypath/tmp_1_$$.json 5 tmpjson=$mypath/tmp_1_$$.json
6 6
7 silentfile=$audiopath/20sec-silence.wav 7 silentfile=$audiopath/20sec-silence.wav
8 infile=$audiopath/3clicks8.wav
8 9
9 trap "rm -f $tmpjson" 0 10 trap "rm -f $tmpjson" 0
10 11
11 transformdir=$mypath/transforms 12 transformdir=$mypath/transforms
12 13
13 mandatory="-w jams" 14 mandatory="-w jams"
14 15
15 # This does not yet test for correct values, only for parseable json 16 # First check that the JSON is valid for all outputs
16 17
17 for output in instants curve-oss curve-fsr curve-fsr-timed curve-vsr grid-oss grid-fsr notes-regions; do 18 for output in instants curve-oss curve-fsr curve-fsr-timed curve-vsr grid-oss grid-fsr notes-regions; do
18 19
19 $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \ 20 $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \
20 fail "Failed to run for plugin $testplug with output $output" 21 fail "Failed to run for plugin $testplug with output $output"
21 22
22 check_json "$tmpjson" "test plugin output $output" 23 check_json "$tmpjson" "test plugin output $output"
24
23 done 25 done
24 26
27 # Now check for valid results, for a subset
28
29 for output in instants curve-fsr grid-oss notes-regions; do
30
31 $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \
32 fail "Failed to run for plugin $testplug with output $output"
33
34 expected="$mypath/expected/$output.json"
35 jsoncompare "$tmpjson" "$expected" || \
36 faildiff "Output differs from expected for $output" "$tmpjson" "$expected"
37
38 done
39
40 # Test digits option, with an output that has lots of digits to round
41
42 for digits in 0 6 2; do
43
44 $r -t "$transformdir/af.n3" $mandatory --jams-digits "$digits" --jams-one-file "$tmpjson" --jams-force "$infile" 2>/dev/null || \
45 fail "Failed to run for af with digits = $digits"
46
47 expected="$mypath/expected/af-$digits.json"
48 jsoncompare "$tmpjson" "$expected" || \
49 faildiff "Output differs from expected for af with digits = $digits" "$tmpjson" "$expected"
50
51 done
52