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_distance_travelled(self): t = 1 # seconds passed result = day14.get_distance_travelled(self.comet, t) self.assertEqual(14, result) result = day14.get_distance_travelled(self.dancer, t) self.assertEqual(16, result) t = 10 # seconds passed result = day14.get_distance_travelled(self.comet, t) self.assertEqual(140, result) result = day14.get_distance_travelled(self.dancer, t) self.assertEqual(160, result) t = 11 # seconds passed result = day14.get_distance_travelled(self.comet, t) self.assertEqual(140, result) result = day14.get_distance_travelled(self.dancer, t) self.assertEqual(176, result) t = 1000 # seconds passed result = day14.get_distance_travelled(self.comet, t) self.assertEqual(1120, result) result = day14.get_distance_travelled(self.dancer, t) self.assertEqual(1056, result)