diff tests/test-summaries.sh @ 28:102bb1729184 sonic-annotator-0.4

* Test fixes for cases where the behaviour has actually been fixed for 0.4 * Emphasise this change in CHANGELOG
author Chris Cannam
date Fri, 25 Sep 2009 12:00:58 +0000
parents 0f7c8b9410ef
children 94d988cef54e
line wrap: on
line diff
--- a/tests/test-summaries.sh	Thu Sep 24 14:34:00 2009 +0000
+++ b/tests/test-summaries.sh	Fri Sep 25 12:00:58 2009 +0000
@@ -11,7 +11,9 @@
 
 trap "rm -f $tmpfile $tmpcanonical $tmpcmp1 $tmpcmp2" 0
 
-fail() {
+. test-include.sh
+
+faildiff() {
     echo "Test failed: $1"
     if [ -n "$2" -a -n "$3" ]; then
 	echo "Output follows:"
@@ -24,7 +26,7 @@
 	echo "--"
 	echo "Diff:"
 	echo "--"
-	diff -u $2 $3
+	sdiff -w78 $2 $3
 	echo "--"
     fi
     exit 1
@@ -35,7 +37,7 @@
     b=$2
     sort $a > $tmpcmp1
     sort $b > $tmpcmp2
-    cmp -s $tmpcmp1 $tmpcmp2
+    csvcompare $tmpcmp1 $tmpcmp2
 }
 
 # transform to which we have to add summarisation on command line
@@ -49,25 +51,25 @@
     fail "Fails to run transform $transform"
 
 compare $tmpfile ${expected}.csv || \
-    fail "Output mismatch for transform $transform" $tmpfile ${expected}.csv
+    faildiff "Output mismatch for transform $transform" $tmpfile ${expected}.csv
 
 $r -t $transform -w csv --csv-stdout -S mean $infile > $tmpfile 2>/dev/null || \
     fail "Fails to run transform $transform with summary type mean"
 
 compare $tmpfile ${expected}-with-mean.csv || \
-    fail "Output mismatch for transform $transform with summary type mean" $tmpfile ${expected}-with-mean.csv
+    faildiff "Output mismatch for transform $transform with summary type mean" $tmpfile ${expected}-with-mean.csv
 
 $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 || \
     fail "Fails to run transform $transform with all summary types and summary-only"
 
 compare $tmpfile ${expected}-all-summaries-only.csv || \
-    fail "Output mismatch for transform $transform with all summary types and summary-only" $tmpfile ${expected}-all-summaries-only.csv
+    faildiff "Output mismatch for transform $transform with all summary types and summary-only" $tmpfile ${expected}-all-summaries-only.csv
 
 $r -t $stransform -w csv --csv-stdout $infile > $tmpfile 2>/dev/null || \
     fail "Fails to run transform $stransform with CSV output"
 
 compare $tmpfile ${sexpected}.csv || \
-    fail "Output mismatch for transform $stransform" $tmpfile ${sexpected}.csv
+    faildiff "Output mismatch for transform $stransform" $tmpfile ${sexpected}.csv
 
 $r -t $stransform -w rdf --rdf-stdout $infile > $tmpfile 2>/dev/null || \
     fail "Fails to run transform $stransform with RDF output"
@@ -76,7 +78,7 @@
     fail "Fails to produce parseable RDF/TTL for transform $stransform"
 
 compare $tmpcanonical ${sexpected}.n3 || \
-    fail "Output mismatch for canonicalised version of transform $stransform" $tmpcanonical ${sexpected}.n3
+    faildiff "Output mismatch for canonicalised version of transform $stransform" $tmpcanonical ${sexpected}.n3
 
 exit 0