summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 20254ed)
raw | patch | inline | side by side (parent: 20254ed)
author | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Sun, 13 Nov 2011 17:12:56 +0000 (17:12 +0000) | ||
committer | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Sun, 13 Nov 2011 17:12:56 +0000 (17:12 +0000) |
odcread.cc | patch | blob | history | |
paths.txt | [new file with mode: 0644] | patch | blob |
test.sh | [new file with mode: 0755] | patch | blob |
diff --git a/odcread.cc b/odcread.cc
index e790fdd36bcdc3b211d3c4d277cf9462ee6db3dd..858028e6babf5e252ede8ade0c0f71d2946ceb4e 100644 (file)
--- a/odcread.cc
+++ b/odcread.cc
return 1;
}
std::ifstream in(argv[1], std::ios::in | std::ios::binary);
- odc::Store* s = odc::importDocument(in);
+
+ odc::Store* s;
+ try {
+ s = odc::importDocument(in);
+ } catch (int trap) {
+ std::cerr << "Exception in parsing file: BlackBox trap no. " << trap << std::endl;
+ return 2;
+ } catch (const char * exception) {
+ std::cerr << "Exception in parsing file: " << exception << std::endl;
+ return 2;
+ }
// std::cout << s->toPlainText() << std::endl;
// std::cout << std::endl << std::endl;
- odc::MyVisitor visitor;
- s->accept(visitor);
+ try {
+ odc::MyVisitor visitor;
+ s->accept(visitor);
+ } catch (const char * exception) {
+ std::cerr << "Exception in processing document: " << exception << std::endl;
+ return 3;
+ }
// std::cout << s->toString() << std::endl;
// std::cout << in.tellg() << " " << in.eof() << std::endl;
diff --git a/paths.txt b/paths.txt
--- /dev/null
+++ b/paths.txt
@@ -0,0 +1,8 @@
+/home/gert/WINBUGS TSD2/
+/home/gert/Downloads/complex-interventsions/
+/home/gert/Downloads/jasa web/
+/home/gert/Downloads/bias-jrssa/
+/home/gert/Downloads/RBugsfiles/
+/home/gert/.wine/drive_c/Program Files/WinBUGS14/
+/home/gert/.wine/drive_c/Program Files/BlackBox Component Builder 1.5/
+/home/gert/.wine/drive_c/Program Files/OpenBUGS/OpenBUGS321/
diff --git a/test.sh b/test.sh
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+SEP="================================================================================"
+
+runTests() {
+ echo "Output files to $outdir"
+ while read i; do
+ echo -e "$SEP\n$SEP"
+ echo "Running examples from " $i
+ (cd "$i"
+ find . -name '*.odc' | while read j; do
+ echo $SEP
+ echo "Running example $j from $i"
+ out=${j/#\.\//}
+ out=${out//\//_}
+ echo "Output being sent to $out"
+ out=$outdir/$out
+ $odcread "$j" >"$out"
+ done
+ )
+ echo
+ done < 'paths.txt'
+}
+
+# create clean output directory
+rm -rf out
+mkdir out
+
+odcread=`readlink -f odcread`
+outdir=`readlink -f out`
+
+runTests 2>&1 | tee out.txt