marking1/drumb_test2.scala
author Christian Urban <urbanc@in.tum.de>
Mon, 15 Jan 2018 23:15:34 +0000
changeset 167 1bbd4db36151
parent 158 f60e0908f80b
child 169 8a1bd8ddb96c
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
158
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
//println("starting test now")
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
/*
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
import scala.concurrent._
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
import scala.concurrent.duration._
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
import ExecutionContext.Implicits.global
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
import scala.language.postfixOps 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
val urban_prices = List(List(Some(71.539941), None), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
                        List(Some(76.974614), None), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
                        List(Some(65.226685), Some(6.35)), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
                        List(Some(78.354649), Some(12.241)), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
                        List(Some(85.517645), Some(38.188)))
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
val urban_deltas = List(List(Some(0.07596697626574789), None), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
                        List(Some(-0.152620823795232), None), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
                        List(Some(0.20126676681483952), Some(0.9277165354330709)), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
                        List(Some(0.09141762603007778), Some(2.119679764725104)))
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
lazy val f = Future {
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
  //assert(get_deltas(urban_prices) == urban_deltas)
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
  assert (get_deltas(get_prices(List("IBM", "BIDU"), 2004 to 2008)) == urban_deltas)
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
}
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
Await.result(f, 180 second)
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
*/
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
val urban_prices = List(List(Some(311.349976), Some(27.505054)), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
			List(Some(300.222351), Some(42.357094)), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
			List(Some(330.555054), Some(52.852215)))
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
assert(CW6c.get_deltas(urban_prices) == List(List(Some(-0.03573992567129673), Some(0.5399749442411563)), 
f60e0908f80b updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
                                             List(Some(0.10103412653643493), Some(0.2477771728154912))))