Make the non-regression testing more robust by feeding the output
[SXSI/xpathcomp.git] / tests / non_regression_tests / test.sh
index 4b5e442..2024bff 100755 (executable)
@@ -1,15 +1,31 @@
 #!/bin/sh
 
 MAIN=../../main.native
-for i in *count*.xp
+for i in *.xp
 do
-    echo "$i"-------------------
+    echo -n Test "$i" "..."
     ref=`basename "$i" .xp`.output
     doc=$(cat "$i" | cut -f 1 -d ',')
     options=$(cat "$i" | cut -f 2 -d ',')
     query=$(cat "$i" | cut -f 3 -d ',')
     rm -f tmp
-    $MAIN $options "../docs/$doc".xml "$query" /dev/stdout 2>/dev/null
-    cat "$ref"
-    echo -----------------------------------------
+    if [ -f "../docs/$doc".srx ]
+    then
+        input="../docs/$doc".srx
+    else
+        input="../docs/$doc".xml
+    fi
+    $MAIN $options "$input" "$query" tmp 2>/dev/null
+    if diff -q -w -B tmp "$ref"
+    then
+        echo " ok"
+    else
+        echo failure
+        echo -----------------------
+        echo Difference:
+        diff -w -B tmp "$ref"
+        echo -----------------------
+        echo
+    fi
+
 done
\ No newline at end of file