384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1 |
#!/bin/zsh
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2 |
set -euo pipefail
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
5 |
out=${1:-output}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
echo -e "" > $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
8 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
9 |
echo `date` >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
10 |
echo -e "Below is the feedback and provisional marks for your submission" >> $out
|
424
|
11 |
echo -e "of the Core Part 3 (Scala). Please note all marks are provisional until" >> $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
12 |
echo -e "ratified by the assessment board -- this is not an official" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
13 |
echo -e "results transcript." >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
14 |
echo -e "" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
15 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
echo -e "Below is the feedback for your submission docdiff.scala" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
17 |
echo -e "" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
18 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
19 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
20 |
# marks for CW9 preliminary
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
21 |
marks=$(( 0.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
22 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
23 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
24 |
# compilation tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
25 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
26 |
function scala_compile {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
27 |
(ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
28 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
29 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
30 |
# functional tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
31 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
32 |
function scala_assert {
|
394
|
33 |
(ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
34 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
35 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
36 |
# purity test
|
424
|
37 |
function scala_vars {
|
|
38 |
(sed 's/immutable/ok/g' c$out > cb$out;
|
|
39 |
egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' cb$out 2> /dev/null 1> /dev/null)
|
|
40 |
}
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
41 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
42 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
43 |
# compilation test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
44 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
45 |
echo -e "postfix.scala runs?" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
46 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
47 |
if (scala_compile postfix.scala)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
48 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
49 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
50 |
tsts=$(( 0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
51 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
52 |
echo -e " --> SCALA DID NOT RUN postfix.scala\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
53 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
54 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
55 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
56 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
57 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
58 |
# var, return, ListBuffer test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
59 |
#
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
60 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
61 |
then
|
386
|
62 |
echo -e "postfix.scala does not contain VARS, RETURNS etc?" | tee -a $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
63 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
64 |
if (scala_vars postfix.scala)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
65 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
66 |
echo -e " --> FAIL\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
67 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
68 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
69 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
70 |
tsts=$(( 0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
71 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
72 |
else
|
386
|
73 |
tsts=$(( 1 ))
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
74 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
75 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
76 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
77 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
78 |
### postfix tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
79 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
80 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
81 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
82 |
echo -e " syard(split(\"3 + 4 * ( 2 - 1 )\")) == List(\"3\", \"4\", \"2\", \"1\", \"-\", \"*\", \"+\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
83 |
echo -e " syard(split(\"( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )\")) == List(\"3\", \"4\", \"5\", \"+\", \"+\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
84 |
echo -e " syard(split(\"5 + 7 / 2\")) == List(\"5\", \"7\", \"2\", \"/\", \"+\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
85 |
echo -e " syard(split(\"5 * 7 / 2\")) == List(\"5\", \"7\", \"*\", \"2\", \"/\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
86 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
87 |
if (scala_assert "postfix.scala" "postfix_test1.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
88 |
then
|
463
|
89 |
echo -e " --> success (+ 1 Mark)\n" | tee -a $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
90 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
91 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
92 |
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
93 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
94 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
95 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
96 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
97 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
98 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
99 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
100 |
echo -e " compute(syard(split(\"3 + 4 * ( 2 - 1 )\"))) == 7" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
101 |
echo -e " compute(syard(split(\"10 + 12 * 33\"))) == 406" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
102 |
echo -e " compute(syard(split(\"( 5 + 7 ) * 2\"))) == 24" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
103 |
echo -e " compute(syard(split(\"5 + 7 / 2\"))) == 8" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
104 |
echo -e " compute(syard(split(\"5 * 7 / 2\"))) == 17" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
105 |
echo -e " compute(syard(split(\"9 + 24 / ( 7 - 3 )\"))) == 15" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
106 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
107 |
if (scala_assert "postfix.scala" "postfix_test2.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
108 |
then
|
463
|
109 |
echo -e " --> success (+ 1 Mark)\n" | tee -a $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
110 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
111 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
112 |
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
113 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
114 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
115 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
116 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
117 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
118 |
### postfix2 tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
119 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
120 |
echo -e "Below is the feedback for your submission postfix2.scala" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
121 |
echo -e "" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
122 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
123 |
# compilation test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
124 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
125 |
echo -e "postfix2.scala runs?" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
126 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
127 |
if (scala_compile postfix2.scala)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
128 |
then
|
463
|
129 |
echo -e " --> success\n" | tee -a $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
130 |
tsts=$(( 0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
131 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
132 |
echo -e " --> SCALA DID NOT RUN postfix2.scala\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
133 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
134 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
135 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
136 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
137 |
# var, return, ListBuffer test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
138 |
#
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
139 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
140 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
141 |
echo -e "postfix2.scala does not contain VARS, RETURNS etc?" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
142 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
143 |
if (scala_vars postfix2.scala)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
144 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
145 |
echo -e " --> FAIL\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
146 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
147 |
else
|
463
|
148 |
echo -e " --> success\n" | tee -a $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
149 |
tsts=$(( 0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
150 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
151 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
152 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
153 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
154 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
155 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
156 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
157 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
158 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
159 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
160 |
echo -e " syard(split(\"3 + 4 * ( 2 - 1 )\")) == List(\"3\", \"4\", \"2\", \"1\", \"-\", \"*\", \"+\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
161 |
echo -e " syard(split(\"( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )\")) == List(\"3\", \"4\", \"5\", \"+\", \"+\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
162 |
echo -e " syard(split(\"5 + 7 / 2\")) == List(\"5\", \"7\", \"2\", \"/\", \"+\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
163 |
echo -e " syard(split(\"5 * 7 / 2\")) == List(\"5\", \"7\", \"*\", \"2\", \"/\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
164 |
echo -e " syard(split(\"3 + 4 * 8 / ( 5 - 1 ) ^ 2 ^ 3\")) == " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
165 |
echo -e " List(\"3\", \"4\", \"8\", \"*\", \"5\", \"1\", \"-\", \"2\", \"3\", \"^\", \"^\", \"/\", \"+\")" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
166 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
167 |
if (scala_assert "postfix2.scala" "postfix_test3.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
168 |
then
|
463
|
169 |
echo -e " --> success (+ 0.5 Marks)\n" | tee -a $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
170 |
marks=$(( marks + 0.5 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
171 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
172 |
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
173 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
174 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
175 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
176 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
177 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
178 |
echo -e " compute(syard(split(\"3 + 4 * ( 2 - 1 )\"))) == 7" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
179 |
echo -e " compute(syard(split(\"10 + 12 * 33\"))) == 406" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
180 |
echo -e " compute(syard(split(\"( 5 + 7 ) * 2\"))) == 24" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
181 |
echo -e " compute(syard(split(\"5 + 7 / 2\"))) == 8" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
182 |
echo -e " compute(syard(split(\"5 * 7 / 2\"))) == 17" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
183 |
echo -e " compute(syard(split(\"9 + 24 / ( 7 - 3 )\"))) == 15" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
184 |
echo -e " compute(syard(split(\"4 ^ 3 ^ 2\"))) == 262144" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
185 |
echo -e " compute(syard(split(\"4 ^ ( 3 ^ 2 )\"))) == 262144" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
186 |
echo -e " compute(syard(split(\"( 4 ^ 3 ) ^ 2\"))) == 4096" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
187 |
echo -e " compute(syard(split(\"( 3 + 1 ) ^ 2 ^ 3\"))) == 65536" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
188 |
|
386
|
189 |
if (scala_assert "postfix2.scala" "postfix_test4.scala")
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
190 |
then
|
463
|
191 |
echo -e " --> success (+ 0.5 Marks)\n" | tee -a $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
192 |
marks=$(( marks + 0.5 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
193 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
194 |
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
195 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
196 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
197 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
198 |
## final marks
|
424
|
199 |
echo -e "Overall mark for the Core Part 3 (Scala)" | tee -a $out
|
384
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
200 |
printf " %0.1f\n" $marks | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
201 |
|