marking1/drumb_test5.scala
author Christian Urban <urbanc@in.tum.de>
Thu, 01 Aug 2019 09:48:34 +0100
changeset 268 e43f7e92ba26
parent 260 b4812c877b05
child 281 87b9e3e2c1a7
permissions -rw-r--r--
updated

def myassert(cond : => Boolean) = {
  try {
    assert(cond)
  } catch { 
    case _ : Throwable => System.exit(1)
  }
}

// get_prices(List("GOOG", "AAPL"), 2010 to 2012)
val urban_prices = List(List(Some(312.204773), Some(26.782711)), 
                        List(Some(301.0466), Some(41.244694)), 
                        List(Some(331.462585), Some(51.464207)))


myassert(get_deltas(urban_prices) == List(List(Some(-0.03573991804411003), Some(0.539974575389325)), 
                                          List(Some(0.10103414222249969), Some(0.24777764141006836))))


//get_prices(List("BIDU"), 2004 to 2008)
val urban_prices2 = List(List(None), List(None), 
                         List(Some(6.35)), List(Some(12.241)), 
                         List(Some(38.188)))


myassert(get_deltas(urban_prices2) == List(List(None), List(None), 
                                        List(Some(0.9277165354330709)), 
                                        List(Some(2.119679764725104))))