Exemple #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)
Exemple #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')
Exemple #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)
Exemple #4
0
 def test_part_1_23(self):
     self.assertEqual(solve_part_1(23), 2)
Exemple #5
0
 def test_solve_part_1(self):
     programs = 'abcde'
     commands = ['s1', 'x3/4', 'pe/b']
     self.assertEqual(solve_part_1(programs, commands), 'baedc')
Exemple #6
0
 def test_solve_part_1(self):
     self.assertEqual(solve_part_1(range(5), [3, 4, 1, 5]), 12)
Exemple #7
0
 def test_solve_part_1_1234(self):
     self.assertEqual(solve_part_1('1234'), 0)
Exemple #8
0
 def test_part_1_12(self):
     self.assertEqual(solve_part_1(12), 3)
Exemple #9
0
 def test_solve_part_1(self):
     self.assertEqual(solve_part_1({0: 3, 1: 2, 4: 4, 6: 4}), 24)
Exemple #10
0
 def test_solve_part_1(self):
     self.assertEqual(solve_part_1('flqrgnkx'), 8108)
Exemple #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)
Exemple #12
0
 def test_solve_part_1_1111(self):
     self.assertEqual(solve_part_1('1111'), 4)
Exemple #13
0
 def test_solve_part_1_1122(self):
     self.assertEqual(solve_part_1('1122'), 3)
Exemple #14
0
 def test_solve_part_1_91212129(self):
     self.assertEqual(solve_part_1('91212129'), 9)
Exemple #15
0
 def test_part_1_1024(self):
     self.assertEqual(solve_part_1(1024), 31)
Exemple #16
0
 def test_part_1_1(self):
     self.assertEqual(solve_part_1(1), 0)
Exemple #17
0
 def test_solve_part_1(self):
     self.assertEqual(solve_part_1(3), 638)
Exemple #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)
Exemple #19
0
    def test_part_1(self):
        puzzle_input = [0, 3, 0, 1, -3]

        self.assertEqual(solve_part_1(puzzle_input), 5)