84 echo -e " get_january_data(\"GOOG\", 1980) == List()" | tee -a $out |
84 echo -e " get_january_data(\"GOOG\", 1980) == List()" | tee -a $out |
85 echo -e " get_january_data(\"GOOG\", 2010).head == \"2010-01-04,312.204773\"" | tee -a $out |
85 echo -e " get_january_data(\"GOOG\", 2010).head == \"2010-01-04,312.204773\"" | tee -a $out |
86 |
86 |
87 if (scala_assert "drumb.scala" "drumb_test1.scala") |
87 if (scala_assert "drumb.scala" "drumb_test1.scala") |
88 then |
88 then |
89 echo -e " --> success" | tee -a $out |
89 echo -e " --> success (+ 0.5 Marks)\n" | tee -a $out |
90 marks=$(( marks + 0.5 )) |
90 marks=$(( marks + 0.5 )) |
91 else |
91 else |
92 echo -e " --> TEST FAILED\n" | tee -a $out |
92 echo -e " --> TEST FAILED\n" | tee -a $out |
93 fi |
93 fi |
94 fi |
94 fi |
100 echo -e " get_first_price(\"GOOG\", 1980) == None" | tee -a $out |
100 echo -e " get_first_price(\"GOOG\", 1980) == None" | tee -a $out |
101 echo -e " get_first_price(\"GOOG\", 2010) == Some(312.204773)" | tee -a $out |
101 echo -e " get_first_price(\"GOOG\", 2010) == Some(312.204773)" | tee -a $out |
102 |
102 |
103 if (scala_assert "drumb.scala" "drumb_test2.scala") |
103 if (scala_assert "drumb.scala" "drumb_test2.scala") |
104 then |
104 then |
105 echo -e " --> success" | tee -a $out |
105 echo -e " --> success (+ 1 Mark)\n" | tee -a $out |
106 marks=$(( marks + 1.0 )) |
106 marks=$(( marks + 1.0 )) |
107 else |
107 else |
108 echo -e " --> TEST FAILED\n" | tee -a $out |
108 echo -e " --> TEST FAILED\n" | tee -a $out |
109 fi |
109 fi |
110 fi |
110 fi |
122 echo -e " List(Some(301.0466), Some(41.244694))," | tee -a $out |
122 echo -e " List(Some(301.0466), Some(41.244694))," | tee -a $out |
123 echo -e " List(Some(331.462585), Some(51.464207)))" | tee -a $out |
123 echo -e " List(Some(331.462585), Some(51.464207)))" | tee -a $out |
124 |
124 |
125 if (scala_assert "drumb.scala" "drumb_test3.scala") |
125 if (scala_assert "drumb.scala" "drumb_test3.scala") |
126 then |
126 then |
127 echo -e " --> success" | tee -a $out |
127 echo -e " --> success (+ 1 Mark)\n" | tee -a $out |
128 marks=$(( marks + 1.0 )) |
128 marks=$(( marks + 1.0 )) |
129 else |
129 else |
130 echo -e " --> TEST FAILED\n" | tee -a $out |
130 echo -e " --> TEST FAILED\n" | tee -a $out |
131 fi |
131 fi |
132 fi |
132 fi |
140 echo -e " get_delta(None, Some(100.0)) == None" | tee -a $out |
140 echo -e " get_delta(None, Some(100.0)) == None" | tee -a $out |
141 echo -e " get_delta(Some(50.0), Some(100.0)) == Some(1.0)" | tee -a $out |
141 echo -e " get_delta(Some(50.0), Some(100.0)) == Some(1.0)" | tee -a $out |
142 |
142 |
143 if (scala_assert "drumb.scala" "drumb_test4.scala") |
143 if (scala_assert "drumb.scala" "drumb_test4.scala") |
144 then |
144 then |
145 echo -e " --> success" | tee -a $out |
145 echo -e " --> success (+ 1 Mark)\n" | tee -a $out |
146 marks=$(( marks + 1.0 )) |
146 marks=$(( marks + 1.0 )) |
147 else |
147 else |
148 echo -e " --> TEST FAILED\n" | tee -a $out |
148 echo -e " --> TEST FAILED\n" | tee -a $out |
149 fi |
149 fi |
150 fi |
150 fi |
162 echo -e " List(List(None), List(None), " | tee -a $out |
162 echo -e " List(List(None), List(None), " | tee -a $out |
163 echo -e " List(Some(0.9277165354330709)), List(Some(2.119679764725104)))" | tee -a $out |
163 echo -e " List(Some(0.9277165354330709)), List(Some(2.119679764725104)))" | tee -a $out |
164 |
164 |
165 if (scala_assert "drumb.scala" "drumb_test5.scala") |
165 if (scala_assert "drumb.scala" "drumb_test5.scala") |
166 then |
166 then |
167 echo -e " --> success" | tee -a $out |
167 echo -e " --> success (+ 1 Mark)\n" | tee -a $out |
168 marks=$(( marks + 1.0 )) |
168 marks=$(( marks + 1.0 )) |
169 else |
169 else |
170 echo -e " --> TEST FAILED\n" | tee -a $out |
170 echo -e " --> TEST FAILED\n" | tee -a $out |
171 fi |
171 fi |
172 fi |
172 fi |
180 echo -e " yearly_yield(ds, 100, 0) == 125" | tee -a $out |
180 echo -e " yearly_yield(ds, 100, 0) == 125" | tee -a $out |
181 echo -e " yearly_yield(ds, 100, 1) == 117" | tee -a $out |
181 echo -e " yearly_yield(ds, 100, 1) == 117" | tee -a $out |
182 |
182 |
183 if (scala_assert "drumb.scala" "drumb_test6.scala") |
183 if (scala_assert "drumb.scala" "drumb_test6.scala") |
184 then |
184 then |
185 echo -e " --> success" | tee -a $out |
185 echo -e " --> success (+ 1 Mark)\n" | tee -a $out |
186 marks=$(( marks + 1.0 )) |
186 marks=$(( marks + 1.0 )) |
187 else |
187 else |
188 echo -e " --> TEST FAILED\n" | tee -a $out |
188 echo -e " --> TEST FAILED\n" | tee -a $out |
189 fi |
189 fi |
190 fi |
190 fi |
192 |
192 |
193 ### investment_test |
193 ### investment_test |
194 |
194 |
195 if [ $tsts -eq 0 ] |
195 if [ $tsts -eq 0 ] |
196 then |
196 then |
|
197 #echo -e "NEEDS ADJUSTING" |
197 echo -e " All results need to be in the range of -/+ 1% of the given values." | tee -a $out |
198 echo -e " All results need to be in the range of -/+ 1% of the given values." | tee -a $out |
198 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2000, 100) == 100" | tee -a $out |
199 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2000, 100) == 100" | tee -a $out |
199 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2001, 100) == 27 " | tee -a $out |
200 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2001, 100) == 27 " | tee -a $out |
200 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2002, 100) == 42 " | tee -a $out |
201 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2002, 100) == 42 " | tee -a $out |
201 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2003, 100) == 27 " | tee -a $out |
202 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2003, 100) == 27 " | tee -a $out |
202 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2004, 100) == 38 " | tee -a $out |
203 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2004, 100) == 38 " | tee -a $out |
203 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2005, 100) == 113" | tee -a $out |
204 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2005, 100) == 113" | tee -a $out |
204 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2006, 100) == 254" | tee -a $out |
205 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2006, 100) == 254" | tee -a $out |
205 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2007, 100) == 349" | tee -a $out |
206 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 2000 to 2007, 100) == 349" | tee -a $out |
206 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 1990 to 2017, 100) == 11504" | tee -a $out |
207 echo -e " investment(List(\"GOOG\", \"AAPL\", \"BIDU\"), 1990 to 2017, 100) == 11504" | tee -a $out |
207 |
208 START=$(date +%s) |
208 |
209 |
209 if (scala_assert "drumb.scala" "drumb_test7.scala") |
210 if (scala_assert "drumb.scala" "drumb_test7.scala") |
210 then |
211 then |
211 echo -e " --> success" | tee -a $out |
212 END=$(date +%s) |
|
213 DIFF=$(( $END - $START )) |
|
214 echo -e " --> success (+ 0.5 Marks)\n" | tee -a $out |
212 marks=$(( marks + 0.5 )) |
215 marks=$(( marks + 0.5 )) |
213 else |
216 else |
|
217 END=$(date +%s) |
|
218 DIFF=$(( $END - $START )) |
|
219 echo -e " This test ran for $DIFF seconds" | tee -a $out |
214 echo -e " --> TEST FAILED\n" | tee -a $out |
220 echo -e " --> TEST FAILED\n" | tee -a $out |
215 fi |
221 fi |
216 fi |
222 fi |
217 |
223 |
218 ## final marks |
224 ## final marks |