diff -r fa7f7144f2bb -r d8dbf91c149b main_testing5/bfc_test.sh --- a/main_testing5/bfc_test.sh Tue Dec 07 23:17:51 2021 +0000 +++ b/main_testing5/bfc_test.sh Mon Jan 03 00:59:32 2022 +0000 @@ -1,7 +1,9 @@ #!/bin/bash -set -e +set -euo pipefail -out=${1:-output} +scalafile=${1:-bfc.scala} +out=${2:-output} + echo -e "" > $out @@ -32,7 +34,7 @@ # compilation test echo -e "bfc.scala runs?" >> $out -if (scala_compile bfc.scala) +if (scala_compile $scalafile) then echo -e " --> passed" >> $out tsts1=$(( 0 )) @@ -48,7 +50,7 @@ then echo -e "bfc.scala does not contain vars, returns etc?" >> $out - if (scala_vars bfc.scala) + if (scala_vars $scalafile) then echo -e " --> FAIL (make triple-sure your program conforms to the required format)" >> $out tsts1=$(( 1 )) @@ -65,7 +67,7 @@ echo -e " jtable(\"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]\"\"\") ==" >> $out echo -e " Map(69 -> 61, 5 -> 20, 60 -> 70, 27 -> 44, 43 -> 28, 19 -> 6)" >> $out - if (scala_assert "bfc.scala" "bf_test5.scala") + if (scala_assert $scalafile "bf_test5.scala") then echo -e " --> success" >> $out else @@ -79,7 +81,7 @@ then echo -e " optimise(load_bff(\"benchmark.bf\")).length == 181" >> $out echo -e " optimise(load_bff(\"mandelbrot.bf\")).length == 11205" >> $out - if (scala_assert "bfc.scala" "bf_test6.scala") + if (scala_assert $scalafile "bf_test6.scala") then echo -e " --> success" >> $out else @@ -94,7 +96,7 @@ echo -e " combine(optimise(load_bff(\"benchmark.bf\"))).length == 134" >> $out echo -e " combine(optimise(load_bff(\"mandelbrot.bf\"))).length == 6511" >> $out - if (scala_assert "bfc.scala" "bf_test7.scala") + if (scala_assert $scalafile "bf_test7.scala") then echo -e " --> success" >> $out else