3 import scala.concurrent._ |
3 import scala.concurrent._ |
4 import scala.concurrent.duration._ |
4 import scala.concurrent.duration._ |
5 import ExecutionContext.Implicits.global |
5 import ExecutionContext.Implicits.global |
6 import scala.language.postfixOps |
6 import scala.language.postfixOps |
7 |
7 |
|
8 val urban_prices = List(List(Some(71.539941), None), |
|
9 List(Some(76.974614), None), |
|
10 List(Some(65.226685), Some(6.35)), |
|
11 List(Some(78.354649), Some(12.241)), |
|
12 List(Some(85.517645), Some(38.188))) |
|
13 |
|
14 val urban_deltas = List(List(Some(0.07596697626574789), None), |
|
15 List(Some(-0.152620823795232), None), |
|
16 List(Some(0.20126676681483952), Some(0.9277165354330709)), |
|
17 List(Some(0.09141762603007778), Some(2.119679764725104))) |
|
18 |
|
19 |
8 lazy val f = Future { |
20 lazy val f = Future { |
9 assert(get_prices(List("BIDU"), 2004 to 2008) == List(List(None), List(None), |
21 //assert(get_deltas(urban_prices) == urban_deltas) |
10 List(Some(6.35)), List(Some(12.241)), |
22 assert (get_deltas(get_prices(List("IBM", "BIDU"), 2004 to 2008)) == urban_deltas) |
11 List(Some(38.188)))) |
|
12 } |
23 } |
13 |
24 |
14 |
25 |
15 Await.result(f, 180 second) |
26 Await.result(f, 180 second) |
16 |
27 |