main_testing5/bf_test.sh
changeset 419 d8dbf91c149b
parent 404 bf20a9fa5c29
child 426 b51467741af2
--- 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