annotate tests/test-csv-writer/test-csv-writer.sh @ 200:f35bbb3e4d41 sonic-annotator-1.2

Change of tack: rename the JSON writer to JAMS. It's simpler than having a JSON writer with a mandatory flag to tell it what sort of JSON to write.
author Chris Cannam
date Tue, 01 Sep 2015 17:51:03 +0100
parents a2310369b2cc
children e8f2f530c091
rev   line source
Chris@155 1 #!/bin/bash
Chris@155 2
Chris@155 3 . ../include.sh
Chris@155 4
Chris@155 5 infile=$audiopath/20sec-silence.wav
Chris@156 6 tmpcsv=$mypath/tmp_1_$$.csv
Chris@155 7
Chris@156 8 trap "rm -f $tmpcsv" 0
Chris@155 9
Chris@155 10 for output in notes-regions curve-vsr; do
Chris@155 11
Chris@155 12 flag=""
Chris@155 13
Chris@156 14 $r -d "$testplug:$output" -w csv --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@155 15 fail "Failed to run for plugin $testplug with output $output and no additional flags"
Chris@155 16
Chris@156 17 csvcompare "$tmpcsv" "$mypath/expected/$output-no-flags.csv" || \
Chris@156 18 faildiff "Output differs from expected for output $output and no additional flags" "$tmpcsv" "$mypath/expected/$output-no-flags.csv"
Chris@155 19
Chris@156 20 flag=sample-timing
Chris@155 21
Chris@156 22 $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@155 23 fail "Failed to run for plugin $testplug with output $output and $flag flag"
Chris@155 24
Chris@156 25 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@156 26 faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@156 27
Chris@158 28 flag=fill-ends
Chris@158 29
Chris@158 30 $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@158 31 fail "Failed to run for plugin $testplug with output $output and $flag flag"
Chris@158 32
Chris@158 33 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@158 34 faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@158 35
Chris@156 36 flag=end-times
Chris@156 37
Chris@156 38 $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@156 39 fail "Failed to run for plugin $testplug with output $output and $flag flag"
Chris@156 40
Chris@156 41 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@156 42 faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@156 43
Chris@156 44 flag=separator
Chris@156 45
Chris@156 46 $r -d "$testplug:$output" -w csv --csv-$flag '@' --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@156 47 fail "Failed to run for plugin $testplug with output $output and $flag flag"
Chris@156 48
Chris@156 49 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@156 50 faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@156 51
Chris@158 52 flag=all
Chris@158 53
Chris@158 54 $r -d "$testplug:$output" -w csv --csv-sample-timing --csv-fill-ends --csv-end-times --csv-separator '@' --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
Chris@158 55 fail "Failed to run for plugin $testplug with output $output and all flags"
Chris@158 56
Chris@158 57 csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
Chris@158 58 faildiff "Output differs from expected for output $output and all flags" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
Chris@158 59
Chris@155 60 done
Chris@155 61
Chris@155 62 exit 0
Chris@155 63