386
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 |
out=${1:-output}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
8 |
echo "" > $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
9 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
10 |
echo `date` >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
11 |
echo -e "Below is the feedback and provisional marks for your submission" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
12 |
echo -e "of the Preliminary Part of Part 4 (Scala). Please note all marks are provisional until" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
13 |
echo -e "ratified by the assessment board -- this is not an official" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
14 |
echo -e "results transcript." >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
15 |
echo -e "" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
17 |
echo -e "Below is the feedback for your submission knight1.scala" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
18 |
echo -e "" >> $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
19 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
20 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
21 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
22 |
# marks for CW8 part 1
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
23 |
marks=$(( 0.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
24 |
|
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 "$1") # 2>> $out 1>> $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_compile {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
33 |
(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
|
34 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
35 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
36 |
# functional tests
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
37 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
38 |
function scala_assert {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
39 |
(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
|
40 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
41 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
42 |
function scala_assert_slow {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
43 |
(ulimit -t 120; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
44 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
45 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
46 |
function scala_assert_thirty {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
47 |
(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
|
48 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
49 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
50 |
function scala_assert_quick {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
51 |
(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
|
52 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
53 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
54 |
function scala_assert_long {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
55 |
(ulimit -t 60; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
|
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 |
function scala_assert_elong {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
59 |
(ulimit -t 90; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
60 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
61 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
62 |
# purity test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
63 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
64 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
65 |
function scala_vars {
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
66 |
(egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
67 |
}
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
68 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
69 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
70 |
# compilation test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
71 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
72 |
echo -e "knight1.scala runs?" | 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_compile knight1.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 " --> success " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
77 |
tsts=$(( 0 ))
|
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 " --> SCALA DID NOT RUN KNIGHT1.SCALA\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
80 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
81 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
82 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
83 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
84 |
# knights1: purity test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
85 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
86 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
87 |
echo -e "knight1.scala does not contain VARS, RETURNS etc?" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
88 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
89 |
if (scala_vars knight1.scala)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
90 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
91 |
echo -e " --> FAIL\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
92 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
93 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
94 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
95 |
tsts=$(( 0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
96 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
97 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
98 |
tsts=$(( 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
99 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
100 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
101 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
102 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
103 |
### knight1 test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
104 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
105 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
106 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
107 |
echo " is_legal(8, Nil, (3, 4)) == true " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
108 |
echo " is_legal(8, List((4, 1), (1, 0)), (4, 1)) == false " | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
109 |
echo " is_legal(2, Nil, (0, 0)) == true" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
110 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
111 |
if (scala_assert "knight1.scala" "knight1_test1.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
112 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
113 |
echo -e " --> success" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
114 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
115 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
116 |
echo -e " --> \n ONE TEST FAILED\n"| tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
117 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
118 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
119 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
120 |
### knight2 test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
121 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
122 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
123 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
124 |
echo " legal_moves(8, Nil, (2,2)) == List((3,4), (4,3), (4,1), (3,0), (1,0), (0,1), (0,3), (1,4))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
125 |
echo " legal_moves(8, Nil, (7,7)) == List((6,5), (5,6))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
126 |
echo " legal_moves(8, List((4,1), (1,0)), (2,2)) == List((3,4), (4,3), (3,0), (0,1), (0,3), (1,4))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
127 |
echo " legal_moves(8, Nil, (0,1)) == List((1,3), (2,2), (2,0))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
128 |
echo " legal_moves(8, List((6,6)), (7,7)) == List((6,5), (5,6))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
129 |
echo " legal_moves(1, Nil, (0,0)) == Nil" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
130 |
echo " legal_moves(2, Nil, (0,0)) == Nil" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
131 |
echo " legal_moves(3, Nil, (0,0)) == List((1,2), (2,1))" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
132 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
133 |
if (scala_assert "knight1.scala" "knight1_test2.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
134 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
135 |
echo -e " --> success\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
136 |
marks=$(( marks + 1 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
137 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
138 |
echo -e " --> ONE TEST FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
139 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
140 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
141 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
142 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
143 |
### knight3 test
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
144 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
145 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
146 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
147 |
echo " count_tours from every position on the board 1 - 4" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
148 |
echo " dim = 1: 1" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
149 |
echo " 2: 0,0,0,0" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
150 |
echo " 3: 0,0,0,0,0,0,0,0,0" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
151 |
echo " 4: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
152 |
START=$(date +%s)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
153 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
154 |
if (scala_assert "knight1.scala" "knight1_test3a.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
155 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
156 |
END=$(date +%s)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
157 |
DIFF=$(( $END - $START ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
158 |
echo " It took $DIFF seconds" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
159 |
echo -e " --> success\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
160 |
marks=$(( marks + 0.5 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
161 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
162 |
END=$(date +%s)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
163 |
DIFF=$(( $END - $START ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
164 |
echo " It took $DIFF seconds" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
165 |
echo -e " --> ONE TEST 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 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
170 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
171 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
172 |
echo " count_tours from every position on the board of dim 5" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
173 |
echo " dim = 5: 304,0,56,0,304,0,56,0,56,0,56,0,64,0,56,0,56,0,56,0,304,0,56,0,304" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
174 |
START=$(date +%s)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
175 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
176 |
if (scala_assert "knight1.scala" "knight1_test3b.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
177 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
178 |
END=$(date +%s)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
179 |
DIFF=$(( $END - $START ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
180 |
echo " It took $DIFF seconds" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
181 |
echo -e " --> success\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
182 |
marks=$(( marks + 0.5 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
183 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
184 |
END=$(date +%s)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
185 |
DIFF=$(( $END - $START ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
186 |
echo " It took $DIFF seconds" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
187 |
echo -e " --> ONE TEST FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
188 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
189 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
190 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
191 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
192 |
if [ $tsts -eq 0 ]
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
193 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
194 |
echo " enum_tours(5, List((0,2)) ) => 56 tours? and all correct?" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
195 |
echo " enum_tours(5, List((0,0)) ) => 304 tours? and all correct?" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
196 |
START=$(date +%s)
|
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 "knight1.scala" "knight1_test3c.scala")
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
199 |
then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
200 |
END=$(date +%s)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
201 |
DIFF=$(( $END - $START ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
202 |
echo " It took $DIFF seconds" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
203 |
echo -e " --> success\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
204 |
marks=$(( marks + 1.0 ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
205 |
else
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
206 |
END=$(date +%s)
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
207 |
DIFF=$(( $END - $START ))
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
208 |
echo " It took $DIFF seconds" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
209 |
echo -e " --> \n ONE TEST FAILED\n" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
210 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
211 |
fi
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
212 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
213 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
214 |
## final marks
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
215 |
echo -e "Overall mark for the Preliminary Part 4 (Scala)" | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
216 |
printf " %0.1f\n" $marks | tee -a $out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
217 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
218 |
|