updated test with second arguments
authorChristian Urban <christian.urban@kcl.ac.uk>
Mon, 03 Jan 2022 00:59:32 +0000
changeset 419 d8dbf91c149b
parent 418 fa7f7144f2bb
child 420 4edc1a308652
updated test with second arguments
main_testing5/bf_test.sh
main_testing5/bfc_test.sh
--- a/main_testing5/bf_test.sh	Tue Dec 07 23:17:51 2021 +0000
+++ b/main_testing5/bf_test.sh	Mon Jan 03 00:59:32 2022 +0000
@@ -1,7 +1,9 @@
 #!/bin/bash
 set -euo pipefail
 
-out=${1:-output}
+
+scalafile=${1:-bf.scala}
+out=${2:-output}
 
 echo -e "" > $out
 
@@ -32,7 +34,7 @@
 # compilation test
 echo -e "bf.scala runs?" >> $out
 
-if (scala_compile bf.scala)
+if (scala_compile $scalafile)
 then
     echo -e "  --> passed" >> $out
     tsts1=$(( 0 ))
@@ -49,7 +51,7 @@
 then
     echo -e "bf.scala does not contain vars, returns etc?" >> $out
 
-    if (scala_vars bf.scala)
+    if (scala_vars $scalafile)
     then
 	echo -e "   --> FAIL (make triple-sure your program conforms to the required format)" >> $out  
 	tsts1=$(( 1 ))
@@ -68,7 +70,7 @@
   echo -e " load_bff(\"benchmark.bf\").length == 188" >> $out
   echo -e " load_bff(\"foobar.bf\") == \"\"" >> $out  
   
-  if (scala_assert "bf.scala" "bf_test1.scala")
+  if (scala_assert $scalafile "bf_test1.scala")
   then
     echo -e "  --> success" >> $out
   else
@@ -83,7 +85,7 @@
   echo -e " write(Map(), 1, 2) == Map(1 -> 2)" >> $out
   echo -e " write(Map(1 -> 0), 1, 2) == Map(1 -> 2)" >> $out
   
-  if (scala_assert "bf.scala" "bf_test2.scala")
+  if (scala_assert $scalafile "bf_test2.scala")
   then
     echo -e "  --> success" >> $out
   else
@@ -104,7 +106,7 @@
     echo -e " jumpLeft(\"[xxxxxx]xxx\", 7, 0) == -1" >> $out
     echo -e " jumpLeft(\"[x[][]x]xxx\", 6, 0) == 1" >> $out
   
-  if (scala_assert "bf.scala" "bf_test3.scala")
+  if (scala_assert $scalafile "bf_test3.scala")
   then
     echo -e "  --> success" >> $out
   else
@@ -123,7 +125,7 @@
   echo -e " run(\"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++" >> $out
   echo -e "        <<]>>++<<----------[+>.>.<+<]\"\"\") == Map(0 -> 0, 1 -> 58, 2 -> 32)" >> $out
 
-  if (scala_assert "bf.scala" "bf_test4.scala")
+  if (scala_assert $scalafile "bf_test4.scala")
   then
     echo -e "  --> success" >> $out
   else
--- 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