equal
deleted
inserted
replaced
5 out=${1:-output} |
5 out=${1:-output} |
6 |
6 |
7 echo -e "" > $out |
7 echo -e "" > $out |
8 |
8 |
9 |
9 |
10 echo "Below is the feedback and provisional marks for your submission" >> $out |
10 echo -e "Below is the feedback and provisional marks for your submission" >> $out |
11 echo "for assignment 9 Part 2. Please note all marks are provisional until" >> $out |
11 echo -e "the preliminary part for assignment 9. Please note all marks are provisional until" >> $out |
12 echo "ratified by the assessment board -- this is not an official" >> $out |
12 echo -e "ratified by the assessment board -- this is not an official" >> $out |
13 echo "results transcript." >> $out |
13 echo -e "results transcript." >> $out |
14 echo "" >> $out |
14 echo -e "" > $out |
15 |
15 |
16 # marks for CW9 part 2 |
16 # marks for CW9 part 2 |
17 marks=$(( 0 )) |
17 marks=$(( 0 )) |
18 |
18 |
19 |
19 |
20 # compilation tests |
20 # compilation tests |
21 |
21 |
22 function scala_compile { |
22 function scala_compile { |
23 (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc "$1" 2>> $out 1>> $out) |
23 (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala "$1" 2>> $out 1>> $out) |
24 } |
24 } |
25 |
25 |
26 # functional tests |
26 # functional tests |
27 |
27 |
28 function scala_assert { |
28 function scala_assert { |
29 (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -nc -i "$1" "$2" -e "" 2> /dev/null 1> /dev/null) |
29 (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2") #2> /dev/null 1> /dev/null) |
30 } |
30 } |
31 |
31 |
32 # purity test |
32 # purity test |
33 |
33 |
34 function scala_vars { |
34 function scala_vars { |
40 # |
40 # |
41 echo -e "postfix.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out |
41 echo -e "postfix.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out |
42 |
42 |
43 if (scala_vars postfix.scala) |
43 if (scala_vars postfix.scala) |
44 then |
44 then |
45 echo " --> test failed" | tee -a $out |
45 echo -e " --> FAIL (make triple-sure your program conforms to the required format)\n" | tee -a $out |
46 tsts0=$(( 1 )) |
46 tsts0=$(( 1 )) |
47 else |
47 else |
48 echo " --> success" | tee -a $out |
48 echo -e " --> success" | tee -a $out |
49 tsts0=$(( 0 )) |
49 tsts0=$(( 0 )) |
50 fi |
50 fi |
51 |
51 |
52 # compilation test |
52 # compilation test |
53 if [ $tsts0 -eq 0 ] |
53 if [ $tsts0 -eq 0 ] |
54 then |
54 then |
55 echo "postfix.scala runs?" | tee -a $out |
55 echo -e "postfix.scala runs?" | tee -a $out |
56 |
56 |
57 if (scala_compile postfix.scala) |
57 if (scala_compile postfix.scala) |
58 then |
58 then |
59 echo " --> success" | tee -a $out |
59 echo -e " --> success" | tee -a $out |
60 tsts1=$(( 0 )) |
60 tsts1=$(( 0 )) |
61 else |
61 else |
62 echo " --> scala postfix.scala did not run successfully" | tee -a $out |
62 echo -e " --> SCALA DID NOT RUN postfix.scala" | tee -a $out |
63 tsts1=$(( 1 )) |
63 tsts1=$(( 1 )) |
64 fi |
64 fi |
65 else |
65 else |
66 tsts1=$(( 1 )) |
66 tsts1=$(( 1 )) |
67 fi |
67 fi |
79 if (scala_assert "postfix.scala" "postfix_test7.scala") |
79 if (scala_assert "postfix.scala" "postfix_test7.scala") |
80 then |
80 then |
81 echo -e " --> success" | tee -a $out |
81 echo -e " --> success" | tee -a $out |
82 marks=$(( marks + 1 )) |
82 marks=$(( marks + 1 )) |
83 else |
83 else |
84 echo -e " --> test failed" | tee -a $out |
84 echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out |
85 fi |
85 fi |
86 fi |
86 fi |
87 |
87 |
88 |
88 |
89 |
89 |
99 if (scala_assert "postfix.scala" "postfix_test8.scala") |
99 if (scala_assert "postfix.scala" "postfix_test8.scala") |
100 then |
100 then |
101 echo -e " --> success" | tee -a $out |
101 echo -e " --> success" | tee -a $out |
102 marks=$(( marks + 1 )) |
102 marks=$(( marks + 1 )) |
103 else |
103 else |
104 echo " --> test failed" | tee -a $out |
104 echo " --> ONE OF THE TESTS FAILED\n" | tee -a $out |
105 fi |
105 fi |
106 fi |
106 fi |
107 |
107 |
108 |
108 |
109 |
109 |
113 # |
113 # |
114 echo -e "postfix2.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out |
114 echo -e "postfix2.scala does not contain vars, returns, Arrays, ListBuffers etc?" | tee -a $out |
115 |
115 |
116 if (scala_vars postfix2.scala) |
116 if (scala_vars postfix2.scala) |
117 then |
117 then |
118 echo " --> test failed" | tee -a $out |
118 echo -e " --> FAIL (make triple-sure your program conforms to the required format)\n" | tee -a $out |
119 tsts0=$(( 1 )) |
119 tsts0=$(( 1 )) |
120 else |
120 else |
121 echo " --> success" | tee -a $out |
121 echo -e " --> success" | tee -a $out |
122 tsts0=$(( 0 )) |
122 tsts0=$(( 0 )) |
123 fi |
123 fi |
124 |
124 |
125 |
125 |
126 # compilation test |
126 # compilation test |
127 |
127 |
128 # compilation test |
128 # compilation test |
129 if [ $tsts0 -eq 0 ] |
129 if [ $tsts0 -eq 0 ] |
130 then |
130 then |
131 echo "postfix2.scala runs?" | tee -a $out |
131 echo -e "postfix2.scala runs?" | tee -a $out |
132 |
132 |
133 if (scala_compile postfix2.scala) |
133 if (scala_compile postfix2.scala) |
134 then |
134 then |
135 echo " --> success" | tee -a $out |
135 echo -e " --> success" | tee -a $out |
136 tsts1=$(( 0 )) |
136 tsts1=$(( 0 )) |
137 else |
137 else |
138 echo " --> scala postfix2.scala did not run successfully" | tee -a $out |
138 echo -e " --> SCALA DID NOT RUN postfix2.scala" | tee -a $out |
139 tsts1=$(( 1 )) |
139 tsts1=$(( 1 )) |
140 fi |
140 fi |
141 else |
141 else |
142 tsts1=$(( 1 )) |
142 tsts1=$(( 1 )) |
143 fi |
143 fi |
166 if (scala_assert "postfix2.scala" "postfix_test9.scala") |
166 if (scala_assert "postfix2.scala" "postfix_test9.scala") |
167 then |
167 then |
168 echo -e " --> success" | tee -a $out |
168 echo -e " --> success" | tee -a $out |
169 marks=$(( marks + 2 )) |
169 marks=$(( marks + 2 )) |
170 else |
170 else |
171 echo " --> test failed" | tee -a $out |
171 echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out |
172 fi |
172 fi |
173 fi |
173 fi |
174 |
174 |
175 ## final marks |
175 ## final marks |
176 echo "Overall mark for CW 9, Part 2" | tee -a $out |
176 echo -e "Overall mark for CW 9, Preliminary Part" | tee -a $out |
177 echo "$marks" | tee -a $out |
177 echo -e "$marks" | tee -a $out |