Chris@0: #!/bin/bash Chris@0: Chris@119: . ../include.sh Chris@0: Chris@119: infile=$audiopath/3clicks8.wav Chris@119: infile2=$audiopath/6clicks8.wav Chris@0: tmpfile=$mypath/tmp_1_$$ Chris@0: tmpcanonical=$mypath/tmp_2_$$ Chris@59: expcanonical=$mypath/tmp_exp_2_$$ Chris@16: tmpcmp1=$mypath/tmp_3_$$ Chris@16: tmpcmp2=$mypath/tmp_4_$$ Chris@0: Chris@59: trap "rm -f $tmpfile $tmpcanonical $expcanonical $tmpcmp1 $tmpcmp2" 0 Chris@0: Chris@16: compare() { Chris@16: a=$1 Chris@16: b=$2 Chris@16: sort $a > $tmpcmp1 Chris@16: sort $b > $tmpcmp2 Chris@28: csvcompare $tmpcmp1 $tmpcmp2 Chris@16: } Chris@16: Chris@0: # transform to which we have to add summarisation on command line Chris@119: transform=$mypath/transforms/detectionfunction-nosummaries.n3 Chris@119: expected=$mypath/expected/summaries Chris@0: Chris@119: stransform=$mypath/transforms/detectionfunction.n3 Chris@119: sexpected=$mypath/expected/summaries-from-rdf Chris@0: Chris@182: seglist=$mypath/transforms/segmentlist Chris@182: Chris@0: $r -t $transform -w csv --csv-stdout $infile > $tmpfile 2>/dev/null || \ Chris@0: fail "Fails to run transform $transform" Chris@0: Chris@16: compare $tmpfile ${expected}.csv || \ Chris@28: faildiff "Output mismatch for transform $transform" $tmpfile ${expected}.csv Chris@0: Chris@0: $r -t $transform -w csv --csv-stdout -S mean $infile > $tmpfile 2>/dev/null || \ Chris@0: fail "Fails to run transform $transform with summary type mean" Chris@0: Chris@16: compare $tmpfile ${expected}-with-mean.csv || \ Chris@28: faildiff "Output mismatch for transform $transform with summary type mean" $tmpfile ${expected}-with-mean.csv Chris@0: Chris@0: $r -t $transform -w csv --csv-stdout -S min -S max -S mean -S median -S mode -S sum -S variance -S sd -S count --summary-only $infile > $tmpfile 2>/dev/null || \ Chris@0: fail "Fails to run transform $transform with all summary types and summary-only" Chris@0: Chris@16: compare $tmpfile ${expected}-all-summaries-only.csv || \ Chris@28: faildiff "Output mismatch for transform $transform with all summary types and summary-only" $tmpfile ${expected}-all-summaries-only.csv Chris@0: Chris@0: $r -t $stransform -w csv --csv-stdout $infile > $tmpfile 2>/dev/null || \ Chris@0: fail "Fails to run transform $stransform with CSV output" Chris@0: Chris@16: compare $tmpfile ${sexpected}.csv || \ Chris@28: faildiff "Output mismatch for transform $stransform" $tmpfile ${sexpected}.csv Chris@0: Chris@102: $r -t $stransform -w csv --csv-stdout --summary-only $infile > $tmpfile 2>/dev/null || \ Chris@102: fail "Fails to run transform $stransform with CSV output and summary-only" Chris@102: Chris@102: compare $tmpfile ${expected}-from-rdf-summaries-only.csv || \ Chris@102: faildiff "Output mismatch for transform $stransform with summary-only" $tmpfile ${expected}-from-rdf-summaries-only.csv Chris@102: Chris@105: $r -t $transform -w csv --csv-stdout --summary-only -S median --segments 0,9.9 $infile2 > $tmpfile 2>/dev/null || \ Chris@105: fail "Fails to run transform $stransform with CSV output and segments" Chris@105: Chris@105: compare $tmpfile ${expected}-segments.csv || \ Chris@105: faildiff "Output mismatch for transform $stransform with segments" $tmpfile ${expected}-segments.csv Chris@105: Chris@182: $r -t $transform -w csv --csv-stdout --summary-only -S median --segments-from $seglist $infile2 > $tmpfile 2>/dev/null || \ Chris@182: fail "Fails to run transform $stransform with CSV output and segments from segment list" Chris@182: Chris@182: compare $tmpfile ${expected}-segments.csv || \ Chris@182: faildiff "Output mismatch for transform $stransform with segments from segment list" $tmpfile ${expected}-segments.csv Chris@182: Chris@0: $r -t $stransform -w rdf --rdf-stdout $infile > $tmpfile 2>/dev/null || \ Chris@0: fail "Fails to run transform $stransform with RDF output" Chris@0: Chris@3: rapper -i turtle $tmpfile -o turtle 2>/dev/null | grep -v '^@prefix :' | grep -v 'file:/' > $tmpcanonical || Chris@0: fail "Fails to produce parseable RDF/TTL for transform $stransform" Chris@0: Chris@59: rapper -i turtle ${sexpected}.n3 -o turtle 2>/dev/null | grep -v '^@prefix :' | grep -v 'file:/' > $expcanonical || Chris@59: fail "Internal error: Failed to canonicalise expected output file $expected.n3" Chris@59: Chris@59: compare $tmpcanonical $expcanonical || \ Chris@59: faildiff "Output mismatch for canonicalised version of transform $stransform" $tmpcanonical $expcanonical Chris@0: Chris@0: exit 0 Chris@0: