Mercurial > hg > sonic-annotator
annotate 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 |
rev | line source |
---|---|
Chris@191 | 1 #!/bin/bash |
Chris@191 | 2 |
Chris@191 | 3 . ../include.sh |
Chris@191 | 4 |
Chris@191 | 5 tmpjson=$mypath/tmp_1_$$.json |
Chris@191 | 6 |
Chris@191 | 7 silentfile=$audiopath/20sec-silence.wav |
Chris@204 | 8 infile=$audiopath/3clicks8.wav |
Chris@191 | 9 |
Chris@191 | 10 trap "rm -f $tmpjson" 0 |
Chris@191 | 11 |
Chris@191 | 12 transformdir=$mypath/transforms |
Chris@191 | 13 |
Chris@200 | 14 mandatory="-w jams" |
Chris@197 | 15 |
Chris@204 | 16 # First check that the JSON is valid for all outputs |
Chris@191 | 17 |
Chris@191 | 18 for output in instants curve-oss curve-fsr curve-fsr-timed curve-vsr grid-oss grid-fsr notes-regions; do |
Chris@191 | 19 |
Chris@200 | 20 $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \ |
Chris@191 | 21 fail "Failed to run for plugin $testplug with output $output" |
Chris@191 | 22 |
Chris@191 | 23 check_json "$tmpjson" "test plugin output $output" |
Chris@204 | 24 |
Chris@191 | 25 done |
Chris@191 | 26 |
Chris@204 | 27 # Now check for valid results, for a subset |
Chris@204 | 28 |
Chris@204 | 29 for output in instants curve-fsr grid-oss notes-regions; do |
Chris@204 | 30 |
Chris@204 | 31 $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \ |
Chris@204 | 32 fail "Failed to run for plugin $testplug with output $output" |
Chris@204 | 33 |
Chris@204 | 34 expected="$mypath/expected/$output.json" |
Chris@204 | 35 jsoncompare "$tmpjson" "$expected" || \ |
Chris@204 | 36 faildiff "Output differs from expected for $output" "$tmpjson" "$expected" |
Chris@204 | 37 |
Chris@204 | 38 done |
Chris@204 | 39 |
Chris@204 | 40 # Test digits option, with an output that has lots of digits to round |
Chris@204 | 41 |
Chris@204 | 42 for digits in 0 6 2; do |
Chris@204 | 43 |
Chris@204 | 44 $r -t "$transformdir/af.n3" $mandatory --jams-digits "$digits" --jams-one-file "$tmpjson" --jams-force "$infile" 2>/dev/null || \ |
Chris@204 | 45 fail "Failed to run for af with digits = $digits" |
Chris@204 | 46 |
Chris@204 | 47 expected="$mypath/expected/af-$digits.json" |
Chris@204 | 48 jsoncompare "$tmpjson" "$expected" || \ |
Chris@204 | 49 faildiff "Output differs from expected for af with digits = $digits" "$tmpjson" "$expected" |
Chris@204 | 50 |
Chris@204 | 51 done |
Chris@204 | 52 |