--- a/marking5/bf_test.sh Wed Feb 05 12:24:27 2020 +0000
+++ b/marking5/bf_test.sh Fri Apr 10 12:12:48 2020 +0100
@@ -10,7 +10,7 @@
echo -e "Below is the feedback and provisional marks for your submission" >> $out
-echo -e "for assignment 10 Part 1. Please note all marks are provisional until" >> $out
+echo -e "for assignment 10. Please note all marks are provisional until" >> $out
echo -e "ratified by the assessment board -- this is not an official" >> $out
echo -e "results transcript." >> $out
echo -e "" >> $out
@@ -45,7 +45,7 @@
if (scala_vars bf.scala)
then
- echo -e " --> FAIL (make triple-sure your program conforms to the required format)" | tee -a $out
+ echo -e " --> TEST FAILED\n" | tee -a $out
tsts0=$(( 1 ))
else
echo -e " --> success" | tee -a $out
@@ -63,7 +63,7 @@
echo -e " --> success" | tee -a $out
tsts1=$(( 0 ))
else
- echo -e " --> SCALA DID NOT RUN BF.SCALA\n" | tee -a $out
+ echo -e " --> SCALA DID NOT RUN bf.scala\n" | tee -a $out
tsts1=$(( 1 ))
fi
else
@@ -83,7 +83,7 @@
echo -e " --> success" | tee -a $out
marks=$(( marks + 1 ))
else
- echo -e " --> \n ONE TEST FAILED\n" | tee -a $out
+ echo -e " --> TEST FAILED\n" | tee -a $out
fi
fi
@@ -102,7 +102,7 @@
echo -e " --> success" | tee -a $out
marks=$(( marks + 1 ))
else
- echo -e " --> \n ONE TEST FAILED\n" | tee -a $out
+ echo -e " --> TEST FAILED\n" | tee -a $out
fi
fi
@@ -124,7 +124,7 @@
echo -e " --> success" | tee -a $out
marks=$(( marks + 2 ))
else
- echo -e " --> \n ONE TEST FAILED\n" | tee -a $out
+ echo -e " --> TEST FAILED\n" | tee -a $out
fi
fi
@@ -147,12 +147,123 @@
echo -e " --> success" | tee -a $out
marks=$(( marks + 2 ))
else
- echo -e " --> \n ONE TEST FAILED\n" | tee -a $out
+ echo -e " --> TEST FAILED\n" | tee -a $out
+ fi
+fi
+
+
+# var, return, ListBuffer test
+#
+echo "bfc.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
+
+if (scala_vars bfc.scala)
+then
+ echo -e " --> TEST FAILED\n" | tee -a $out
+ tsts0=$(( 1 ))
+else
+ echo -e " --> success" | tee -a $out
+ tsts0=$(( 0 ))
+fi
+
+
+# compilation test
+if [ $tsts0 -eq 0 ]
+then
+ echo "bfc.scala runs?" | tee -a $out
+
+ if (scala_compile bfc.scala)
+ then
+ echo -e " --> success" | tee -a $out
+ tsts1=$(( 0 ))
+ else
+ echo -e " --> SCALA DID NOT RUN bfc.scala\n" | tee -a $out
+ tsts1=$(( 1 ))
+ fi
+else
+ tsts1=$(( 1 ))
+fi
+
+
+### bfc5 test
+
+if [ $tsts1 -eq 0 ]
+then
+ echo -e " val p1 = \"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++<<]>>++<<----------[+>.>.<+<]\"\"\"" | tee -a $out
+ echo -e " jtable(p1) == Map(69 -> 61, 5 -> 20, 60 -> 70, 27 -> 44, 43 -> 28, 19 -> 6)" | tee -a $out
+ echo -e " val p2 = \"\"\"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.\"\"\"" | tee -a $out
+ echo -e " jtable(p2) == Map(14 -> 34, 33 -> 15, 45 -> 44, 48 -> 9, 43 -> 46, 8 -> 49)" | tee -a $out
+ echo -e " run2(\"[-]\", Map(0 -> 100)) == Map(0 -> 0)" | tee -a $out
+ echo -e " run2(\"[->+<]\", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)" | tee -a $out
+ echo -e " run2(\"[>>+>>+<<<<-]\", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)" | tee -a $out
+ echo -e " run2(\"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++" | tee -a $out
+ echo -e " <<]>>++<<----------[+>.>.<+<]\"\"\") == Map(0 -> 0, 1 -> 58, 2 -> 32)" | tee -a $out
+ echo -e " val hello = \"\"\"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---." | tee -a $out
+ echo -e " +++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.\"\"\"" | tee -a $out
+ echo -e " run2(hello, Map()) == " | tee -a $out
+ echo -e " Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87)" | tee -a $out
+
+ if (scala_assert "bfc.scala" "bf_test5.scala")
+ then
+ echo -e " --> success" | tee -a $out
+ marks=$(( marks + 1 ))
+ else
+ echo -e " --> TEST FAILED\n" | tee -a $out
+ fi
+fi
+
+
+### bfc6 test
+
+if [ $tsts1 -eq 0 ]
+then
+ echo -e " optimise(load_bff(\"benchmark.bf\")).length == 181" | tee -a $out
+ echo -e " optimise(load_bff(\"mandelbrot.bf\")).length == 11203" | tee -a $out
+ echo -e " run3(\"[-]\", Map(0 -> 100)) == Map(0 -> 0)" | tee -a $out
+ echo -e " run3(\"[->+<]\", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)" | tee -a $out
+ echo -e " run3(\"[>>+>>+<<<<-]\", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)" | tee -a $out
+ echo -e " run3(\"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++" | tee -a $out
+ echo -e " <<]>>++<<----------[+>.>.<+<]\"\"\") == Map(0 -> 0, 1 -> 58, 2 -> 32)" | tee -a $out
+ echo -e " val hello = \"\"\"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---." | tee -a $out
+ echo -e " +++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.\"\"\"" | tee -a $out
+ echo -e " run3(hello, Map()) == " | tee -a $out
+ echo -e " Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87)" | tee -a $out
+
+ if (scala_assert "bfc.scala" "bf_test6.scala")
+ then
+ echo -e " --> success" | tee -a $out
+ marks=$(( marks + 1 ))
+ else
+ echo -e " --> TEST FAILED\n" | tee -a $out
+ fi
+fi
+
+### bfc7 test
+
+if [ $tsts1 -eq 0 ]
+then
+ echo -e " combine(optimise(load_bff(\"benchmark.bf\"))).length == 134" | tee -a $out
+ echo -e " combine(optimise(load_bff(\"mandelbrot.bf\"))).length == 6509" | tee -a $out
+ echo -e " run4(\"[-]\", Map(0 -> 100)) == Map(0 -> 0)" | tee -a $out
+ echo -e " run4(\"[->+<]\", Map(0 -> 10)) == Map(0 -> 0, 1 -> 10)" | tee -a $out
+ echo -e " run4(\"[>>+>>+<<<<-]\", Map(0 -> 42)) == Map(0 -> 0, 2 -> 42, 4 -> 42)" | tee -a $out
+ echo -e " run4(\"\"\"+++++[->++++++++++<]>--<+++[->>++++++++++" | tee -a $out
+ echo -e " <<]>>++<<----------[+>.>.<+<]\"\"\") == Map(0 -> 0, 1 -> 58, 2 -> 32)" | tee -a $out
+ echo -e " val hello = \"\"\"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---." | tee -a $out
+ echo -e " +++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.\"\"\"" | tee -a $out
+ echo -e " run4(hello, Map()) == " | tee -a $out
+ echo -e " Map(0 -> 0, 5 -> 33, 1 -> 0, 6 -> 10, 2 -> 72, 3 -> 100, 4 -> 87)" | tee -a $out
+
+ if (scala_assert "bfc.scala" "bf_test7.scala")
+ then
+ echo -e " --> success" | tee -a $out
+ marks=$(( marks + 2 ))
+ else
+ echo -e " --> TEST FAILED\n" | tee -a $out
fi
fi
## final marks
-echo -e "Overall mark for CW 10, Part 1" | tee -a $out
+echo -e "Overall mark for CW 10" | tee -a $out
echo -e "$marks" | tee -a $out