def test_get_points(self): data = {"Comet": self.comet, "Dancer": self.dancer} t = 1 result = day14.get_points(data, t) expect = {"Dancer": 1} self.assertEqual(expect, result) t = 140 result = day14.get_points(data, t) expect = {"Dancer": 139, "Comet": 1} self.assertEqual(expect, result) t = 1000 result = day14.get_points(data, t) expect = {"Dancer": 689, "Comet": 312} self.assertEqual(expect, result)
def test_input(self): import operator parsed = day14.parse_input(day14.INPUT_STRING) results = {} t = 2503 for name, stats in parsed.iteritems(): results[name] = day14.get_distance_travelled(stats, t) print results print sorted(results.items(), key=operator.itemgetter(1)) points = day14.get_points(parsed, t) print sorted(points.items(), key=operator.itemgetter(1)) self.assertTrue(False)
def test_get_points_2(self): data = {"A": (10, 1, 1), "B": (11, 1, 2)} for t in range(1, 5 + 1): result = day14.get_points(data, t) print result