コード例 #1
0
ファイル: test_cases.py プロジェクト: barnybug/aoc2019
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
コード例 #2
0
ファイル: test_day18.py プロジェクト: zhatt/adventofcode2019
 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)
コード例 #3
0
ファイル: test_day18.py プロジェクト: zhatt/adventofcode2019
 def test_part2_example2(self):
     example_input = [
         "###############",
         "#d.ABC.#.....a#",
         "######...######",
         "######.@.######",
         "######...######",
         "#b.....#.....c#",
         "###############",
     ]
     result = day18.part2(example_input)
     self.assertEqual(24, result)
コード例 #4
0
ファイル: test_day18.py プロジェクト: zhatt/adventofcode2019
 def test_part2_example1(self):
     example_input = [
         "#######",
         "#a.#Cd#",
         "##...##",
         "##.@.##",
         "##...##",
         "#cB#Ab#",
         "#######",
     ]
     result = day18.part2(example_input)
     self.assertEqual(8, result)
コード例 #5
0
 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)
コード例 #6
0
 def test_part2_example2(self):
     content = dedent("""
         ###############
         #d.ABC.#.....a#
         ######@#@######
         ###############
         ######@#@######
         #b.....#.....c#
         ###############
         """)
     grid, starting_points = parse2(content)
     self.assertEqual(part2(grid, starting_points), 24)
コード例 #7
0
 def test_part2_example1(self):
     content = dedent("""
         #######
         #a.#Cd#
         ##@#@##
         #######
         ##@#@##
         #cB#Ab#
         #######
         """)
     grid, starting_points = parse2(content)
     self.assertEqual(part2(grid, starting_points), 8)
コード例 #8
0
ファイル: test_day18.py プロジェクト: zhatt/adventofcode2019
 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)
コード例 #9
0
ファイル: test_day18.py プロジェクト: zhatt/adventofcode2019
 def test_part2_input(self):
     result = day18.part2(aoc.read_input('day18.input'))
     self.assertEqual(1996, result)
コード例 #10
0
ファイル: test_day18.py プロジェクト: zhatt/adventofcode2018
 def test_part2_example(self):
     result = day18.part2(self.example_input)
     self.assertEqual(0, result)
コード例 #11
0
ファイル: test_cases.py プロジェクト: barnybug/aoc2020
def test_day18_part2(expression, value):
    assert day18.part2(expression) == value
コード例 #12
0
def test_18_2_examples():
    examples = []
    for (inp, out) in examples:
        assert out == day18.part2(inp)
コード例 #13
0
ファイル: test_day18.py プロジェクト: sguberman/advent2020
def test_part2(puzzle_input, answer):
    assert part2(puzzle_input) == answer