testing1/drumb_test7.scala
changeset 248 1616d06a0893
parent 199 54befaf23648
child 281 87b9e3e2c1a7
equal deleted inserted replaced
247:50a3b874008a 248:1616d06a0893
     1 
     1 
     2 val urban_prices = List(List(Some(311.349976), Some(27.505054)), 
     2 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100)
     3 			List(Some(300.222351), Some(42.357094)), 
     3 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27)
     4 			List(Some(330.555054), Some(52.852215)))
     4 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42)
     5 
     5 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27)
     6 
     6 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38)
     7 assert(CW6c.yearly_yield(CW6c.get_deltas(urban_prices), 100, 0) == 125)
     7 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113)
     8 
     8 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254)
     9 
     9 assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)
    10 val urban_blchip_portfolio = List("GOOG", "AAPL", "MSFT", "IBM", "FB", "AMZN", "BIDU")
       
    11 val urban_rstate_portfolio = List("PLD", "PSA", "AMT", "AIV", "AVB", "BXP", "CCI", 
       
    12                                   "DLR", "EQIX", "EQR", "ESS", "EXR", "FRT", "GGP", "HCP") 
       
    13 
       
    14 val urban_rstate_res = CW6c.investment(urban_rstate_portfolio, 1978 to 2017, 100)
       
    15 val urban_blchip_res = CW6c.investment(urban_blchip_portfolio, 1978 to 2017, 100)
       
    16 
       
    17 // the rstate value is 30895 because of a faulty ESS.cvs file
       
    18 
       
    19 // if you round after each year to a Long you get 30895 and 349597
       
    20 // if you work with doubles until the end and then round to a Long you get 30937 and 355204
       
    21 
       
    22 assert((urban_rstate_res > 30885 && urban_rstate_res < 30905) ||
       
    23        (urban_rstate_res > 30927 && urban_rstate_res < 30947))
       
    24 
       
    25 assert((urban_blchip_res > 349587 && urban_blchip_res < 349607) ||
       
    26        (urban_blchip_res > 355194 && urban_blchip_res < 355214))