changeset 156:0fd5c3c28814 labfile

Add CSV writer tests (passing!)
author Chris Cannam
date Tue, 14 Oct 2014 18:50:01 +0100
parents 6dc824c3f5e1
children 946115b8badd
files tests/test-csv-writer/expected/curve-vsr-end-times.csv tests/test-csv-writer/expected/curve-vsr-no-flags.csv tests/test-csv-writer/expected/curve-vsr-sample-timing.csv tests/test-csv-writer/expected/curve-vsr-separator.csv tests/test-csv-writer/expected/notes-regions-end-times.csv tests/test-csv-writer/expected/notes-regions-no-flags.csv tests/test-csv-writer/expected/notes-regions-sample-timing.csv tests/test-csv-writer/expected/notes-regions-separator.csv tests/test-csv-writer/test-csv-writer.sh tests/test.sh
diffstat 10 files changed, 128 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/curve-vsr-end-times.csv	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav",0.000000000,0,"1 of 10: 0 at 0"
+,0.750000000,0.1,"2 of 10: 0.1 at 0.75"
+,1.500000000,0.2,"3 of 10: 0.2 at 1.5"
+,2.250000000,0.3,"4 of 10: 0.3 at 2.25"
+,3.000000000,0.4,"5 of 10: 0.4 at 3"
+,3.750000000,0.5,"6 of 10: 0.5 at 3.75"
+,4.500000000,0.6,"7 of 10: 0.6 at 4.5"
+,5.250000000,0.7,"8 of 10: 0.7 at 5.25"
+,6.000000000,0.8,"9 of 10: 0.8 at 6"
+,6.750000000,0.9,"10 of 10: 0.9 at 6.75"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/curve-vsr-no-flags.csv	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav",0.000000000,0,"1 of 10: 0 at 0"
+,0.750000000,0.1,"2 of 10: 0.1 at 0.75"
+,1.500000000,0.2,"3 of 10: 0.2 at 1.5"
+,2.250000000,0.3,"4 of 10: 0.3 at 2.25"
+,3.000000000,0.4,"5 of 10: 0.4 at 3"
+,3.750000000,0.5,"6 of 10: 0.5 at 3.75"
+,4.500000000,0.6,"7 of 10: 0.6 at 4.5"
+,5.250000000,0.7,"8 of 10: 0.7 at 5.25"
+,6.000000000,0.8,"9 of 10: 0.8 at 6"
+,6.750000000,0.9,"10 of 10: 0.9 at 6.75"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/curve-vsr-sample-timing.csv	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav",0,0,"1 of 10: 0 at 0"
+,33075,0.1,"2 of 10: 0.1 at 0.75"
+,66150,0.2,"3 of 10: 0.2 at 1.5"
+,99225,0.3,"4 of 10: 0.3 at 2.25"
+,132300,0.4,"5 of 10: 0.4 at 3"
+,165375,0.5,"6 of 10: 0.5 at 3.75"
+,198450,0.6,"7 of 10: 0.6 at 4.5"
+,231525,0.7,"8 of 10: 0.7 at 5.25"
+,264600,0.8,"9 of 10: 0.8 at 6"
+,297675,0.9,"10 of 10: 0.9 at 6.75"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/curve-vsr-separator.csv	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav"@0.000000000@0@"1 of 10: 0 at 0"
+@0.750000000@0.1@"2 of 10: 0.1 at 0.75"
+@1.500000000@0.2@"3 of 10: 0.2 at 1.5"
+@2.250000000@0.3@"4 of 10: 0.3 at 2.25"
+@3.000000000@0.4@"5 of 10: 0.4 at 3"
+@3.750000000@0.5@"6 of 10: 0.5 at 3.75"
+@4.500000000@0.6@"7 of 10: 0.6 at 4.5"
+@5.250000000@0.7@"8 of 10: 0.7 at 5.25"
+@6.000000000@0.8@"9 of 10: 0.8 at 6"
+@6.750000000@0.9@"10 of 10: 0.9 at 6.75"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/notes-regions-end-times.csv	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav",0.000000000,1.750000000,0,"1 of 10: 0 at 0 dur. 1.75"
+,1.000000000,1.500000000,0.1,"2 of 10: 0.1 at 1 dur. 0.5"
+,2.000000000,3.750000000,0.2,"3 of 10: 0.2 at 2 dur. 1.75"
+,3.000000000,3.500000000,0.3,"4 of 10: 0.3 at 3 dur. 0.5"
+,4.000000000,5.750000000,0.4,"5 of 10: 0.4 at 4 dur. 1.75"
+,5.000000000,5.500000000,0.5,"6 of 10: 0.5 at 5 dur. 0.5"
+,6.000000000,7.750000000,0.6,"7 of 10: 0.6 at 6 dur. 1.75"
+,7.000000000,7.500000000,0.7,"8 of 10: 0.7 at 7 dur. 0.5"
+,8.000000000,9.750000000,0.8,"9 of 10: 0.8 at 8 dur. 1.75"
+,9.000000000,9.500000000,0.9,"10 of 10: 0.9 at 9 dur. 0.5"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/notes-regions-no-flags.csv	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav",0.000000000,1.750000000,0,"1 of 10: 0 at 0 dur. 1.75"
+,1.000000000,0.500000000,0.1,"2 of 10: 0.1 at 1 dur. 0.5"
+,2.000000000,1.750000000,0.2,"3 of 10: 0.2 at 2 dur. 1.75"
+,3.000000000,0.500000000,0.3,"4 of 10: 0.3 at 3 dur. 0.5"
+,4.000000000,1.750000000,0.4,"5 of 10: 0.4 at 4 dur. 1.75"
+,5.000000000,0.500000000,0.5,"6 of 10: 0.5 at 5 dur. 0.5"
+,6.000000000,1.750000000,0.6,"7 of 10: 0.6 at 6 dur. 1.75"
+,7.000000000,0.500000000,0.7,"8 of 10: 0.7 at 7 dur. 0.5"
+,8.000000000,1.750000000,0.8,"9 of 10: 0.8 at 8 dur. 1.75"
+,9.000000000,0.500000000,0.9,"10 of 10: 0.9 at 9 dur. 0.5"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/notes-regions-sample-timing.csv	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav",0,77175,0,"1 of 10: 0 at 0 dur. 1.75"
+,44100,22050,0.1,"2 of 10: 0.1 at 1 dur. 0.5"
+,88200,77175,0.2,"3 of 10: 0.2 at 2 dur. 1.75"
+,132300,22050,0.3,"4 of 10: 0.3 at 3 dur. 0.5"
+,176400,77175,0.4,"5 of 10: 0.4 at 4 dur. 1.75"
+,220500,22050,0.5,"6 of 10: 0.5 at 5 dur. 0.5"
+,264600,77175,0.6,"7 of 10: 0.6 at 6 dur. 1.75"
+,308700,22050,0.7,"8 of 10: 0.7 at 7 dur. 0.5"
+,352800,77175,0.8,"9 of 10: 0.8 at 8 dur. 1.75"
+,396900,22050,0.9,"10 of 10: 0.9 at 9 dur. 0.5"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/notes-regions-separator.csv	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav"@0.000000000@1.750000000@0@"1 of 10: 0 at 0 dur. 1.75"
+@1.000000000@0.500000000@0.1@"2 of 10: 0.1 at 1 dur. 0.5"
+@2.000000000@1.750000000@0.2@"3 of 10: 0.2 at 2 dur. 1.75"
+@3.000000000@0.500000000@0.3@"4 of 10: 0.3 at 3 dur. 0.5"
+@4.000000000@1.750000000@0.4@"5 of 10: 0.4 at 4 dur. 1.75"
+@5.000000000@0.500000000@0.5@"6 of 10: 0.5 at 5 dur. 0.5"
+@6.000000000@1.750000000@0.6@"7 of 10: 0.6 at 6 dur. 1.75"
+@7.000000000@0.500000000@0.7@"8 of 10: 0.7 at 7 dur. 0.5"
+@8.000000000@1.750000000@0.8@"9 of 10: 0.8 at 8 dur. 1.75"
+@9.000000000@0.500000000@0.9@"10 of 10: 0.9 at 9 dur. 0.5"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/test-csv-writer.sh	Tue Oct 14 18:50:01 2014 +0100
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. ../include.sh
+
+infile=$audiopath/20sec-silence.wav
+tmpcsv=$mypath/tmp_1_$$.csv
+
+trap "rm -f $tmpcsv" 0
+
+for output in notes-regions curve-vsr; do
+
+    flag=""
+
+    $r -d "$testplug:$output" -w csv --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
+	fail "Failed to run for plugin $testplug with output $output and no additional flags"
+
+    csvcompare "$tmpcsv" "$mypath/expected/$output-no-flags.csv" || \
+	faildiff "Output differs from expected for output $output and no additional flags" "$tmpcsv" "$mypath/expected/$output-no-flags.csv"
+
+    flag=sample-timing
+
+    $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
+	fail "Failed to run for plugin $testplug with output $output and $flag flag"
+
+    csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
+	faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
+
+    flag=end-times
+
+    $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
+	fail "Failed to run for plugin $testplug with output $output and $flag flag"
+
+    csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
+	faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
+
+    flag=separator
+
+    $r -d "$testplug:$output" -w csv --csv-$flag '@' --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
+	fail "Failed to run for plugin $testplug with output $output and $flag flag"
+
+    csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
+	faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
+
+done
+
+exit 0
+
--- a/tests/test.sh	Tue Oct 14 18:39:16 2014 +0100
+++ b/tests/test.sh	Tue Oct 14 18:50:01 2014 +0100
@@ -11,6 +11,7 @@
     as-advertised \
     rdf-writer \
     rdf-destinations \
+    csv-writer \
     csv-destinations \
     lab-writer \
     lab-destinations \