예제 #1
0
    def test_part_1(self):
        passphrases = [
            'aa bb cc dd ee'.split(' '), 'aa bb cc dd aa'.split(' '),
            'aa bb cc dd aaa'.split(' ')
        ]

        self.assertEqual(solve_part_1(passphrases), 2)
예제 #2
0
    def test_solve_part_1(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_1(lines), 'tknk')
예제 #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_1_23(self):
     self.assertEqual(solve_part_1(23), 2)
예제 #5
0
 def test_solve_part_1(self):
     programs = 'abcde'
     commands = ['s1', 'x3/4', 'pe/b']
     self.assertEqual(solve_part_1(programs, commands), 'baedc')
예제 #6
0
 def test_solve_part_1(self):
     self.assertEqual(solve_part_1(range(5), [3, 4, 1, 5]), 12)
예제 #7
0
 def test_solve_part_1_1234(self):
     self.assertEqual(solve_part_1('1234'), 0)
예제 #8
0
 def test_part_1_12(self):
     self.assertEqual(solve_part_1(12), 3)
예제 #9
0
 def test_solve_part_1(self):
     self.assertEqual(solve_part_1({0: 3, 1: 2, 4: 4, 6: 4}), 24)
예제 #10
0
 def test_solve_part_1(self):
     self.assertEqual(solve_part_1('flqrgnkx'), 8108)
예제 #11
0
 def test_solve_part_1(self):
     self.assertEqual(
         solve_part_1([
             'set a 1', 'add a 2', 'mul a a', 'mod a 5', 'snd a', 'set a 0',
             'rcv a', 'jgz a -1', 'set a 1', 'jgz a -2'
         ]), 4)
예제 #12
0
 def test_solve_part_1_1111(self):
     self.assertEqual(solve_part_1('1111'), 4)
예제 #13
0
 def test_solve_part_1_1122(self):
     self.assertEqual(solve_part_1('1122'), 3)
예제 #14
0
 def test_solve_part_1_91212129(self):
     self.assertEqual(solve_part_1('91212129'), 9)
예제 #15
0
 def test_part_1_1024(self):
     self.assertEqual(solve_part_1(1024), 31)
예제 #16
0
 def test_part_1_1(self):
     self.assertEqual(solve_part_1(1), 0)
예제 #17
0
 def test_solve_part_1(self):
     self.assertEqual(solve_part_1(3), 638)
예제 #18
0
    def test_solve_part_1(self):
        puzzle_input = ['5\t1\t9\t5', '7\t5\t3', '2\t4\t6\t8']

        self.assertEqual(solve_part_1(puzzle_input), 18)
예제 #19
0
    def test_part_1(self):
        puzzle_input = [0, 3, 0, 1, -3]

        self.assertEqual(solve_part_1(puzzle_input), 5)