soluce = launch_accumulator(batch_file) # then self.assertEqual(soluce, expect) def test_exemple_2(self): # given batch_file = [ "nop +0", "acc +1", "jmp +4", "acc +3", "jmp -3", "acc -99", "acc +1", "jmp -4", "acc +6" ] expect = 8 # when soluce = accumulator_from_correct_program(batch_file) # then self.assertEqual(soluce, expect) if __name__ == '__main__': batch_file = advent.read_files('puzzle_files/file_08.txt') print('Puzzle : ') print(launch_accumulator(batch_file)) print(accumulator_from_correct_program(batch_file)) unittest.main()
"..##.......", "#...#...#..", ".#....#..#.", "..#.#...#.#", ".#...##..#.", "..#.##.....", ".#.#.#....#", ".#........#", "#.##...#...", "#...##....#", ".#..#...#.#" ] expect = 7 # when soluce = find_all_tree(local_geology, 1) # then self.assertEqual(soluce, expect) def test_multiply_all_solution(self): # given local_geology = [ "..##.......", "#...#...#..", ".#....#..#.", "..#.#...#.#", ".#...##..#.", "..#.##.....", ".#.#.#....#", ".#........#", "#.##...#...", "#...##....#", ".#..#...#.#" ] expect = 336 # when soluce = multiply_all_solution(local_geology) # then self.assertEqual(soluce, expect) if __name__ == '__main__': local_geology = advent.read_files('puzzle_files/file_03.txt') print('Puzzle : ') print(find_all_tree(local_geology, 1)) print(multiply_all_solution(local_geology)) unittest.main()