예제 #1
0
    def test_part_2(self):
        passphrases = [
            'abcde fghij'.split(' '), 'abcde xyz ecdab'.split(' '),
            'a ab abc abd abf abj'.split(' '),
            'iiii oiii ooii oooi oooo'.split(' '),
            'oiii ioii iioi iiio'.split(' ')
        ]

        self.assertEqual(solve_part_2(passphrases), 3)
예제 #2
0
    def test_solve_part_2(self):
        lines = [
            'pbga (66)', 'xhth (57)', 'ebii (61)', 'havc (66)', 'ktlj (57)',
            'fwft (72) -> ktlj, cntj, xhth', 'qoyq (66)',
            'padx (45) -> pbga, havc, qoyq', 'tknk (41) -> ugml, padx, fwft',
            'jptl (61)', 'ugml (68) -> gyxo, ebii, jptl', 'gyxo (61)',
            'cntj (57)'
        ]

        self.assertEqual(solve_part_2(lines), 60)
예제 #3
0
    def test_solve_part_1_and_2(self):
        lines = [
            '0 <-> 2',
            '1 <-> 1',
            '2 <-> 0, 3, 4',
            '3 <-> 2, 4',
            '4 <-> 2, 3, 6',
            '5 <-> 6',
            '6 <-> 4, 5'
        ]

        self.assertEqual(solve_part_1(lines), 6)
        self.assertEqual(solve_part_2(lines), 2)
예제 #4
0
 def test_part_2_350(self):
     self.assertEqual(solve_part_2(350), 351)
예제 #5
0
 def test_part_2_50(self):
     self.assertEqual(solve_part_2(50), 54)
예제 #6
0
 def test_part_2_140(self):
     self.assertEqual(solve_part_2(140), 142)
예제 #7
0
 def test_solve_part_2_example_4(self):
     self.assertEqual(solve_part_2('1,2,4'),
                      '63960835bcdc130f0b66d7ff4f6a5a8e')
예제 #8
0
 def test_part_2_1(self):
     self.assertEqual(solve_part_2(1), 2)
예제 #9
0
 def test_solve_part_2_123123(self):
     self.assertEqual(solve_part_2('123123'), 12)
예제 #10
0
 def test_solve_part_2_example_3(self):
     self.assertEqual(solve_part_2('1,2,3'),
                      '3efbe78a8d82f29979031a4aa0b16a9d')
예제 #11
0
 def test_solve_part_2_1212(self):
     self.assertEqual(solve_part_2('1212'), 6)
예제 #12
0
 def test_solve_part_2_example_1(self):
     self.assertEqual(solve_part_2(''), 'a2582a3a0e66e6e86e3812dcb672a272')
예제 #13
0
    def test_part_2(self):
        puzzle_input = [0, 3, 0, 1, -3]

        self.assertEqual(solve_part_2(puzzle_input), 10)
예제 #14
0
 def test_solve_part_2_1221(self):
     self.assertEqual(solve_part_2('1221'), 0)
예제 #15
0
 def test_solve_part_2(self):
     self.assertEqual(solve_part_2({0: 3, 1: 2, 4: 4, 6: 4}), 10)
예제 #16
0
 def test_solve_part_2(self):
     self.assertEqual(solve_part_2('flqrgnkx'), 1242)
예제 #17
0
 def test_solve_part_2_12131415(self):
     self.assertEqual(solve_part_2('12131415'), 4)
예제 #18
0
 def test_part_2_800(self):
     self.assertEqual(solve_part_2(800), 806)
예제 #19
0
 def test_solve_part_2_example_2(self):
     self.assertEqual(solve_part_2('AoC 2017'),
                      '33efeb34ea91902bb2f59c9920caa6cd')
예제 #20
0
    def test_solve_part_2(self):
        puzzle_input = ['5\t9\t2\t8', '9\t4\t7\t3', '3\t8\t6\t5']

        self.assertEqual(solve_part_2(puzzle_input), 9)
예제 #21
0
 def test_solve_part_2_123425(self):
     self.assertEqual(solve_part_2('123425'), 4)