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