def test_day18_part2(): assert day18.part2('''####### #a.#Cd# ##...## ##.@.## ##...## #cB#Ab# #######''') == 8 assert day18.part2('''############### #d.ABC.#.....a# ###### # ###### #######@####### ###### # ###### #b.....#.....c# ###############''') == 24 assert day18.part2('''############# #DcBa.#.GhKl# #.### # #I### #e#d##@##j#k# ###C# # ###J# #fEbA.#.FgHi# #############''') == 32 assert day18.part2('''############# #g#f.D#..h#l# #F###e#E###.# #dCba # BcIJ# ######@###### #nK.L # G...# #M###N#H###.# #o#m..#i#jk.# #############''') == 72
def test_part2_example3(self): example_input = [ "#############", "#DcBa.#.GhKl#", "#.###...#I###", "#e#d#.@.#j#k#", "###C#...###J#", "#fEbA.#.FgHi#", "#############", ] result = day18.part2(example_input) self.assertEqual(32, result)
def test_part2_example2(self): example_input = [ "###############", "#d.ABC.#.....a#", "######...######", "######.@.######", "######...######", "#b.....#.....c#", "###############", ] result = day18.part2(example_input) self.assertEqual(24, result)
def test_part2_example1(self): example_input = [ "#######", "#a.#Cd#", "##...##", "##.@.##", "##...##", "#cB#Ab#", "#######", ] result = day18.part2(example_input) self.assertEqual(8, result)
def test_part2_example3(self): content = dedent(""" ############# #DcBa.#.GhKl# #.###@#@#I### #e#d#####j#k# ###C#@#@###J# #fEbA.#.FgHi# ############# """) grid, starting_points = parse2(content) self.assertEqual(part2(grid, starting_points), 32)
def test_part2_example2(self): content = dedent(""" ############### #d.ABC.#.....a# ######@#@###### ############### ######@#@###### #b.....#.....c# ############### """) grid, starting_points = parse2(content) self.assertEqual(part2(grid, starting_points), 24)
def test_part2_example1(self): content = dedent(""" ####### #a.#Cd# ##@#@## ####### ##@#@## #cB#Ab# ####### """) grid, starting_points = parse2(content) self.assertEqual(part2(grid, starting_points), 8)
def test_part2_example4(self): example_input = [ "#############", "#g#f.D#..h#l#", "#F###e#E###.#", "#dCba...BcIJ#", "#####.@.#####", "#nK.L...G...#", "#M###N#H###.#", "#o#m..#i#jk.#", "#############", ] result = day18.part2(example_input) self.assertEqual(74, result)
def test_part2_input(self): result = day18.part2(aoc.read_input('day18.input')) self.assertEqual(1996, result)
def test_part2_example(self): result = day18.part2(self.example_input) self.assertEqual(0, result)
def test_day18_part2(expression, value): assert day18.part2(expression) == value
def test_18_2_examples(): examples = [] for (inp, out) in examples: assert out == day18.part2(inp)
def test_part2(puzzle_input, answer): assert part2(puzzle_input) == answer