--- a/marking4/postfix_test.sh Tue Dec 03 11:07:09 2019 +0000
+++ b/marking4/postfix_test.sh Mon Jan 27 10:18:13 2020 +0000
@@ -8,12 +8,12 @@
echo -e "Below is the feedback and provisional marks for your submission" >> $out
-echo -e "the preliminary part for assignment 9. Please note all marks are provisional until" >> $out
+echo -e "of Preliminar 9. 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
+echo -e "" >> $out
-# marks for CW9 part 2
+# marks for CW9 preliminary
marks=$(( 0 ))
@@ -26,23 +26,25 @@
# functional tests
function scala_assert {
- (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2") #2> /dev/null 1> /dev/null)
+ (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null)
}
# purity test
function scala_vars {
- (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
+# (egrep '\bvar\b|\breturn\b|\.par|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
+ (egrep '\bvar\b|\breturn\b|ListBuffer|mutable|new Array' "$1" 2> /dev/null 1> /dev/null)
}
+
# var, return, ListBuffer test
#
echo -e "postfix.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out
if (scala_vars postfix.scala)
then
- echo -e " --> FAIL (make triple-sure your program conforms to the required format)\n" | tee -a $out
+ echo -e " --> FAIL\n" | tee -a $out
tsts0=$(( 1 ))
else
echo -e " --> success" | tee -a $out
@@ -101,7 +103,7 @@
echo -e " --> success" | tee -a $out
marks=$(( marks + 1 ))
else
- echo " --> ONE OF THE TESTS FAILED\n" | tee -a $out
+ echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
fi
fi
@@ -115,7 +117,7 @@
if (scala_vars postfix2.scala)
then
- echo -e " --> FAIL (make triple-sure your program conforms to the required format)\n" | tee -a $out
+ echo -e " --> FAIL\n" | tee -a $out
tsts0=$(( 1 ))
else
echo -e " --> success" | tee -a $out
@@ -125,7 +127,6 @@
# compilation test
-# compilation test
if [ $tsts0 -eq 0 ]
then
echo -e "postfix2.scala runs?" | tee -a $out
@@ -151,7 +152,18 @@
echo -e " syard(split(\"5 * 7 / 2\")) == List(\"5\", \"7\", \"*\", \"2\", \"/\")" | tee -a $out
echo -e " syard(split(\"3 + 4 * 8 / ( 5 - 1 ) ^ 2 ^ 3\")) == " | tee -a $out
echo -e " List(\"3\", \"4\", \"8\", \"*\", \"5\", \"1\", \"-\", \"2\", \"3\", \"^\", \"^\", \"/\", \"+\")" | tee -a $out
- echo -e " " | tee -a $out
+
+ if (scala_assert "postfix2.scala" "postfix_test9.scala")
+ then
+ echo -e " --> success" | tee -a $out
+ marks=$(( marks + 1 ))
+ else
+ echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
+ fi
+fi
+
+if [ $tsts1 -eq 0 ]
+then
echo -e " compute(syard(split(\"3 + 4 * ( 2 - 1 )\"))) == 7" | tee -a $out
echo -e " compute(syard(split(\"10 + 12 * 33\"))) == 406" | tee -a $out
echo -e " compute(syard(split(\"( 5 + 7 ) * 2\"))) == 24" | tee -a $out
@@ -163,10 +175,10 @@
echo -e " compute(syard(split(\"( 4 ^ 3 ) ^ 2\"))) == 4096" | tee -a $out
echo -e " compute(syard(split(\"( 3 + 1 ) ^ 2 ^ 3\"))) == 65536" | tee -a $out
- if (scala_assert "postfix2.scala" "postfix_test9.scala")
+ if (scala_assert "postfix2.scala" "postfix_test10.scala")
then
echo -e " --> success" | tee -a $out
- marks=$(( marks + 2 ))
+ marks=$(( marks + 1 ))
else
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
fi