diff -r 50a3b874008a -r 1616d06a0893 testing1/drumb_test7.scala --- a/testing1/drumb_test7.scala Sat Dec 15 13:46:54 2018 +0000 +++ b/testing1/drumb_test7.scala Sat Dec 15 23:58:12 2018 +0000 @@ -1,26 +1,9 @@ -val urban_prices = List(List(Some(311.349976), Some(27.505054)), - List(Some(300.222351), Some(42.357094)), - List(Some(330.555054), Some(52.852215))) - - -assert(CW6c.yearly_yield(CW6c.get_deltas(urban_prices), 100, 0) == 125) - - -val urban_blchip_portfolio = List("GOOG", "AAPL", "MSFT", "IBM", "FB", "AMZN", "BIDU") -val urban_rstate_portfolio = List("PLD", "PSA", "AMT", "AIV", "AVB", "BXP", "CCI", - "DLR", "EQIX", "EQR", "ESS", "EXR", "FRT", "GGP", "HCP") - -val urban_rstate_res = CW6c.investment(urban_rstate_portfolio, 1978 to 2017, 100) -val urban_blchip_res = CW6c.investment(urban_blchip_portfolio, 1978 to 2017, 100) - -// the rstate value is 30895 because of a faulty ESS.cvs file - -// if you round after each year to a Long you get 30895 and 349597 -// if you work with doubles until the end and then round to a Long you get 30937 and 355204 - -assert((urban_rstate_res > 30885 && urban_rstate_res < 30905) || - (urban_rstate_res > 30927 && urban_rstate_res < 30947)) - -assert((urban_blchip_res > 349587 && urban_blchip_res < 349607) || - (urban_blchip_res > 355194 && urban_blchip_res < 355214)) +assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2000, 100) == 100) +assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2001, 100) == 27) +assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2002, 100) == 42) +assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2003, 100) == 27) +assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2004, 100) == 38) +assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2005, 100) == 113) +assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2006, 100) == 254) +assert(investment(List("GOOG", "AAPL", "BIDU"), 2000 to 2007, 100) == 349)