From: Gert van Valkenhoef Date: Sun, 13 Nov 2011 17:12:56 +0000 (+0000) Subject: Testing odcread against a bunch of existing .odc files X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=41d9c65ec79728a8771cd2288dfc3458569c6801;p=odcread.git Testing odcread against a bunch of existing .odc files --- diff --git a/odcread.cc b/odcread.cc index e790fdd..858028e 100644 --- a/odcread.cc +++ b/odcread.cc @@ -113,12 +113,27 @@ int main(int argc, char *argv[]) { 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 new file mode 100644 index 0000000..baeb906 --- /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 new file mode 100755 index 0000000..022320b --- /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