def test_tree_repeat(self): self.assertEqual( Day3.tree_hit_count(self.day3_test_tree_repeating, 3, 1), 7) self.assertEqual( Day3.tree_hit_count(self.day3_test_tree_repeating, 1, 1), 2) self.assertEqual( Day3.tree_hit_count(self.day3_test_tree_repeating, 5, 1), 3) self.assertEqual( Day3.tree_hit_count(self.day3_test_tree_repeating, 7, 1), 4) self.assertEqual( Day3.tree_hit_count(self.day3_test_tree_repeating, 1, 2), 2) self.assertEqual( Day3.tree_hit_count(self.day3_test_tree_repeating, 3, 1) * Day3.tree_hit_count(self.day3_test_tree_repeating, 1, 1) * Day3.tree_hit_count(self.day3_test_tree_repeating, 5, 1) * Day3.tree_hit_count(self.day3_test_tree_repeating, 7, 1) * Day3.tree_hit_count(self.day3_test_tree_repeating, 1, 2), 336)
def setUp(self): with open('Day3_test_inputs.txt', 'r') as f: day3_test_list = f.readlines() day3_test_inputs = list(map(str.strip, day3_test_list)) with open('day3_inputs.txt', 'r') as f: day3_list = f.readlines() day3_inputs = list(map(str.strip, day3_list)) self.day3_test_tree_repeating = Day3.tree_repeat(day3_test_inputs)
def main(): Day0.run() Day1.run() Day2.run() Day3.run() Day4.run() Day5.run() Day6.run() Day7.run() Day8.run() Day9.run() Day10.run() Day11.run() Day12.run() Day13.run() Day14.run() Day15.run() Day16.run() Day17.run() Day18.run() Day19.run()
def test_puzzledata1(self): self.assertEqual(Day3.solve("puzzledata.txt"), 121163)
def test_testdata1(self): self.assertEqual(Day3.solve("testdata1.txt"), 4)
def test2_norobo(self): testdata = '^>v<' self.assertEqual(Day3.total_delivered_houses(testdata, robosanta=False), 4)
def test3_robo(self): testdata = '^v^v^v^v^v' self.assertEqual(Day3.total_delivered_houses(testdata, robosanta=True), 11)
def test2_robo(self): testdata = '^>v<' self.assertEqual(Day3.total_delivered_houses(testdata, robosanta=True), 3)
def test_run_pt2(self): input_list = common.loadInput('testInput3.txt', True) testObject = Day3.Solution() self.assertEqual(336, testObject.part2(input_list))
def test_run(self): #remember to set the assert to the known examples and place the example test into testInput3.txt! input_list = common.loadInput('testInput3.txt', True) testObject = Day3.Solution() self.assertEqual(7, testObject.part1(input_list))