equal
deleted
inserted
replaced
8 |
8 |
9 echo "" > $out |
9 echo "" > $out |
10 |
10 |
11 |
11 |
12 echo "Below is the feedback and provisional marks for your submission" >> $out |
12 echo "Below is the feedback and provisional marks for your submission" >> $out |
13 echo "for assignment 10 Advanced Part 2. Please note all marks are provisional until" >> $out |
13 echo "for assignment 10 Part 2. Please note all marks are provisional until" >> $out |
14 echo "ratified by the assessment board -- this is not an official" >> $out |
14 echo "ratified by the assessment board -- this is not an official" >> $out |
15 echo "results transcript." >> $out |
15 echo "results transcript." >> $out |
16 echo "" >> $out |
16 echo "" >> $out |
17 |
17 |
18 # marks for CW10 part 2 |
18 # marks for CW10 part 2 |
19 marks=$(( 0 )) |
19 marks=$(( 0 )) |
20 |
20 |
21 # compilation tests |
21 # compilation tests |
22 |
22 |
23 function scala_compile { |
23 function scala_compile { |
24 (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc "$1" 2> /dev/null 1> /dev/null) |
24 (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2> /dev/null 1> /dev/null) |
25 } |
25 } |
26 |
26 |
27 # functional tests |
27 # functional tests |
28 |
28 |
29 function scala_assert { |
29 function scala_assert { |
30 (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) |
30 (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null) |
31 } |
31 } |
32 |
32 |
33 |
33 |
34 # purity test |
34 # purity test |
35 |
35 |
43 # |
43 # |
44 echo "bfc.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out |
44 echo "bfc.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out |
45 |
45 |
46 if (scala_vars bfc.scala) |
46 if (scala_vars bfc.scala) |
47 then |
47 then |
48 echo " --> test failed" | tee -a $out |
48 echo " --> FAIL (make triple-sure your program conforms to the required format)" | tee -a $out |
49 tsts0=$(( 1 )) |
49 tsts0=$(( 1 )) |
50 else |
50 else |
51 echo " --> success" | tee -a $out |
51 echo " --> success" | tee -a $out |
52 tsts0=$(( 0 )) |
52 tsts0=$(( 0 )) |
53 fi |
53 fi |
61 if (scala_compile bfc.scala) |
61 if (scala_compile bfc.scala) |
62 then |
62 then |
63 echo " --> success" | tee -a $out |
63 echo " --> success" | tee -a $out |
64 tsts1=$(( 0 )) |
64 tsts1=$(( 0 )) |
65 else |
65 else |
66 echo " --> scala bfc.scala did not run successfully" | tee -a $out |
66 echo " --> SCALA DID NOT RUN BFC.SCALA\n" | tee -a $out |
67 tsts1=$(( 1 )) |
67 tsts1=$(( 1 )) |
68 fi |
68 fi |
69 else |
69 else |
70 tsts1=$(( 1 )) |
70 tsts1=$(( 1 )) |
71 fi |
71 fi |
92 if (scala_assert "bfc.scala" "bf_test5.scala") |
92 if (scala_assert "bfc.scala" "bf_test5.scala") |
93 then |
93 then |
94 echo " --> success" | tee -a $out |
94 echo " --> success" | tee -a $out |
95 marks=$(( marks + 1 )) |
95 marks=$(( marks + 1 )) |
96 else |
96 else |
97 echo " --> test failed" | tee -a $out |
97 echo " --> \n ONE TEST FAILED\n" | tee -a $out |
98 fi |
98 fi |
99 fi |
99 fi |
100 |
100 |
101 |
101 |
102 ### bfc6 test |
102 ### bfc6 test |
118 if (scala_assert "bfc.scala" "bf_test6.scala") |
118 if (scala_assert "bfc.scala" "bf_test6.scala") |
119 then |
119 then |
120 echo " --> success" | tee -a $out |
120 echo " --> success" | tee -a $out |
121 marks=$(( marks + 1 )) |
121 marks=$(( marks + 1 )) |
122 else |
122 else |
123 echo " --> test failed" | tee -a $out |
123 echo " --> \n ONE TEST FAILED\n" | tee -a $out |
124 fi |
124 fi |
125 fi |
125 fi |
126 |
126 |
127 ### bfc7 test |
127 ### bfc7 test |
128 |
128 |
143 if (scala_assert "bfc.scala" "bf_test7.scala") |
143 if (scala_assert "bfc.scala" "bf_test7.scala") |
144 then |
144 then |
145 echo " --> success" | tee -a $out |
145 echo " --> success" | tee -a $out |
146 marks=$(( marks + 2 )) |
146 marks=$(( marks + 2 )) |
147 else |
147 else |
148 echo " --> test failed" | tee -a $out |
148 echo " --> \n ONE TEST FAILED\n" | tee -a $out |
149 fi |
149 fi |
150 fi |
150 fi |
151 |
151 |
152 |
152 |
153 ## final marks |
153 ## final marks |
154 echo "Overall mark for CW 10, Advanced Part 2" | tee -a $out |
154 echo "Overall mark for CW 10, Part 2" | tee -a $out |
155 echo "$marks" | tee -a $out |
155 echo "$marks" | tee -a $out |
156 |
156 |