def test_strategies(self): out = simulate_clicker(BuildInfo(), 10000000000.0, strategy_cheap) self.assertEqual(round(out.get_cps(), 1), 123436706.3) self.assertEqual(out.get_time(), 10000000000.0) self.assertEqual(round(out.get_cookies(), 1), 149360255735977.9) # ClickerState class doesn't expose total number publicly (should be: total cookies: 1.15285935621e+18) out = simulate_clicker(BuildInfo(), 10000000000.0, strategy_expensive) self.assertEqual(round(out.get_cps(), 1), 133980795.7) self.assertEqual(out.get_time(), 10000000000.0) self.assertEqual(round(out.get_cookies(), 8), 2414.64612076)
def test_simulate(self): out = simulate_clicker(BuildInfo(), 10000000000.0, strategy_cursor) # comparing (after it's been rounded) to known values provided at: # https://class.coursera.org/principlescomputing-001/wiki/view?page=clicker self.assertEqual(round(out.get_cps(), 1), 16.1) self.assertEqual(out.get_time(), 10000000000.0) self.assertEqual(round(out.get_cookies(), 1), 6965195661.5)