Adds a set of testing script:
[tatoo.git] / tools / gen_test.sh
diff --git a/tools/gen_test.sh b/tools/gen_test.sh
new file mode 100755 (executable)
index 0000000..111052f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+usage() {
+    echo "error: missing input, query file or XPathEval class"
+    echo "usage: $0 file.xml"
+}
+
+FILE="$1"
+RESULTS="$FILE".results
+QUERIES="$FILE".queries
+
+if test ! -f "$FILE" -o ! -f "$QUERIES" -o ! -f XPathEval.class
+then
+   usage;
+   exit 1
+fi
+
+
+mkdir -p "$RESULTS"
+
+cat "$QUERIES" | grep -v '^#' | while read qname q
+do
+    echo "Computing $q" 
+    java XPathEval "$FILE" "$q" > "$RESULTS"/"$qname".xml
+done