389
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1 |
#!/bin/zsh
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
# to make the script fail safely
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
set -euo pipefail
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
5 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
out=${1:-output}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
8 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
9 |
echo "" > $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
10 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
11 |
echo -e `date` >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
12 |
echo -e "" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
13 |
echo -e "Below is the feedback and provisional marks for your submission" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
14 |
echo -e "of the Main Part 2 (Scala). Please note all marks are provisional until" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
15 |
echo -e "ratified by the assessment board -- this is not an official" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
echo -e "results transcript." >> $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 |
# marks for core CW7
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
20 |
marks=$(( 0.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
21 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
22 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
23 |
# compilation tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
24 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
25 |
function scala_compile {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
26 |
(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
|
27 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
28 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
29 |
# functional tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
30 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
31 |
function scala_assert {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
32 |
(ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
33 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
34 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
35 |
function scala_assert_thirty {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
36 |
(ulimit -t 40; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
37 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
38 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
39 |
# purity test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
40 |
function scala_vars {
|
424
|
41 |
(sed 's/immutable/ok/g' c$out > cb$out;
|
|
42 |
egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' cb$out 2> /dev/null 1> /dev/null)
|
389
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
43 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
44 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
45 |
|
390
|
46 |
echo -e "" >> $out
|
|
47 |
echo -e "Below is the feedback for your submission danube.scala" >> $out
|
|
48 |
echo -e "" >> $out
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
389
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
53 |
### compilation test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
54 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
55 |
echo -e "danube.scala runs?" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
56 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
57 |
if (scala_compile danube.scala)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
58 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
59 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
60 |
tsts=$(( 0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
61 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
62 |
echo -e " --> SCALA DID NOT RUN danube.scala" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
63 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
64 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
65 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
66 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
67 |
# var, .par return, ListBuffer test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
68 |
#
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
69 |
|
390
|
70 |
if [ $tsts -eq 0 ]
|
|
71 |
then
|
389
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
72 |
echo -e "danube.scala does not contain VARS, RETURNS etc?" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
73 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
74 |
if (scala_vars danube.scala)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
75 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
76 |
echo -e " --> TEST FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
77 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
78 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
79 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
80 |
tsts=$(( 0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
81 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
82 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
83 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
84 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
85 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
86 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
87 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
88 |
### danube get_cvs_url tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
89 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
90 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
91 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
92 |
echo -e "danube.scala tests:" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
93 |
echo -e " val movies_url = \"\"\"https://nms.kcl.ac.uk/christian.urban/movies.csv\"\"\"" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
94 |
echo -e " get_csv_url(movies_url).length == 9742" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
95 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
96 |
if (scala_assert "danube.scala" "danube_test1.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
97 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
98 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
99 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
100 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
101 |
echo -e " --> TEST FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
102 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
103 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
104 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
105 |
### danube processing tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
106 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
107 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
108 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
109 |
echo -e " val good_ratings = process_ratings(ratings)" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
110 |
echo -e " val movie_names = process_movies(movies)" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
111 |
echo -e " " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
112 |
echo -e " good_ratings.length == 48580 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
113 |
echo -e " movie_names.length == 9742 " | tee -a $out
|
424
|
114 |
echo -e " " | tee -a $out
|
|
115 |
echo -e " val r_elems = List((\"1\",\"1\"), (\"1\",\"3\"), (\"1\",\"6\"), (\"1\",\"47\")) " | tee -a $out
|
|
116 |
echo -e " r_elems.forall(good_ratings.contains(_)) == true" | tee -a $out
|
389
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
117 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
118 |
if (scala_assert "danube.scala" "danube_test2.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
119 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
120 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
121 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
122 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
123 |
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
124 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
125 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
126 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
127 |
### danube groupById test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
128 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
129 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
130 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
131 |
echo -e " val ls1 = List((\"1\", \"a\"), (\"2\", \"a\"), (\"1\", \"c\"), (\"2\", \"a\"), (\"1\", \"c\"))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
132 |
echo -e " val ls2 = List((\"1\", \"a\"), (\"1\", \"b\"), (\"2\", \"x\"), (\"3\", \"a\"), (\"2\", \"y\"), (\"3\", \"c\"))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
133 |
echo -e " groupById(ls1, Map()) == Map(1 -> List(c, c, a), 2 -> List(a, a))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
134 |
echo -e " groupById(ls2, Map()) == Map(1 -> List(b, a), 2 -> List(x, y), 3 -> List(c, a))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
135 |
echo -e " where the order in the lists is unimportant" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
136 |
echo -e " val ls3 = (11 to 1000 by 5).map(_.toString).toList" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
137 |
echo -e " val ls4 = ls3 zip ls3.tail" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
138 |
echo -e " val ls5 = ls4 ::: ls4.reverse" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
139 |
echo -e " groupById(ls5, Map()) == Map(11 -> List(16,16), 16 -> List(21,21), ....)" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
140 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
141 |
if (scala_assert "danube.scala" "danube_test3.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
142 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
143 |
echo -e -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
144 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
145 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
146 |
echo -e -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
147 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
148 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
149 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
150 |
### danube favourites tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
151 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
152 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
153 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
154 |
echo -e " val good_ratings = process_ratings(ratings)" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
155 |
echo -e " val ratings_map = groupById(good_ratings, Map())" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
156 |
echo -e " favourites(ratings_map, \"912\").length == 80 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
157 |
echo -e " favourites(ratings_map, \"858\").length == 158 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
158 |
echo -e " favourites(ratings_map, \"260\").length == 201 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
159 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
160 |
if (scala_assert "danube.scala" "danube_test4.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
161 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
162 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
163 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
164 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
165 |
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
166 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
167 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
168 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
169 |
### danube suggestions tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
170 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
171 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
172 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
173 |
echo -e " val good_ratings = process_ratings(ratings)" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
174 |
echo -e " val ratings_map = groupById(good_ratings, Map())" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
175 |
echo -e " suggestions(ratings_map, \"912\").length == 4110 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
176 |
echo -e " suggestions(ratings_map, \"858\").length == 4883 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
177 |
echo -e " suggestions(ratings_map, \"260\").length == 4970 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
178 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
179 |
if (scala_assert "danube.scala" "danube_test5.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
180 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
181 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
182 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
183 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
184 |
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
185 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
186 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
187 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
188 |
### danube recommendation tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
189 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
190 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
191 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
192 |
echo -e " recommendations(ratings_map, movies_map, \"1\").length == 2 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
193 |
echo -e " recommendations(ratings_map, movies_map, \"2\").length == 2 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
194 |
echo -e " recommendations(ratings_map, movies_map, \"3\").length == 2 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
195 |
echo -e " recommendations(ratings_map, movies_map, \"4\").length == 0 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
196 |
echo -e " recommendations(ratings_map, movies_map, \"5\").length == 2 " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
197 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
198 |
if (scala_assert "danube.scala" "danube_test6.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
199 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
200 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
201 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
202 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
203 |
echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
204 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
205 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
206 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
207 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
208 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
209 |
## final marks
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
210 |
echo -e "Overall mark for Main Part 2 (Scala)" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
211 |
printf " %0.1f\n" $marks | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
212 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
213 |
|