testing1/drumb_test5.scala
changeset 281 87b9e3e2c1a7
parent 248 1616d06a0893
equal deleted inserted replaced
280:a057dc4457fc 281:87b9e3e2c1a7
     1 
     1 /*def myassert(cond : => Boolean) = {
       
     2   try {
       
     3     assert(cond)
       
     4   } catch { 
       
     5     case _ : Throwable => System.exit(1)
       
     6   }
       
     7 }
       
     8 */
     2 // get_prices(List("GOOG", "AAPL"), 2010 to 2012)
     9 // get_prices(List("GOOG", "AAPL"), 2010 to 2012)
     3 val urban_prices = List(List(Some(311.349976), Some(20.544939)), 
    10 val urban_prices = List(List(Some(312.204773), Some(26.782711)), 
     4                         List(Some(300.222351), Some(31.638695)), 
    11                         List(Some(301.0466), Some(41.244694)), 
     5                         List(Some(330.555054), Some(39.478039)))
    12                         List(Some(331.462585), Some(51.464207)))
     6 
    13 
     7 
    14 
     8 assert(get_deltas(urban_prices) == List(List(Some(-0.03573992567129673), Some(0.539975124774038)), 
    15 assert(CW6b.get_deltas(urban_prices) == List(List(Some(-0.03573991804411003), Some(0.539974575389325)), 
     9                                         List(Some(0.10103412653643493), Some(0.24777709700099845))))
    16                                           List(Some(0.10103414222249969), Some(0.24777764141006836))))
    10 
    17 
    11 
    18 
    12 //get_prices(List("BIDU"), 2004 to 2008)
    19 //get_prices(List("BIDU"), 2004 to 2008)
    13 val urban_prices2 = List(List(None), List(None), 
    20 val urban_prices2 = List(List(None), List(None), 
    14                          List(Some(6.35)), List(Some(12.241)), 
    21                          List(Some(6.35)), List(Some(12.241)), 
    15                          List(Some(38.188)))
    22                          List(Some(38.188)))
    16 
    23 
    17 
    24 
    18 assert(get_deltas(urban_prices2) == List(List(None), List(None), 
    25 assert(CW6b.get_deltas(urban_prices2) == List(List(None), List(None), 
    19                                         List(Some(0.9277165354330709)), 
    26                                         List(Some(0.9277165354330709)), 
    20                                         List(Some(2.119679764725104))))
    27                                         List(Some(2.119679764725104))))