Esempio n. 1
0
 def test_prog1(self):
     test_prog1 = [
         109,
         1,
         204,
         -1,
         1001,
         100,
         1,
         100,
         1008,
         100,
         16,
         101,
         1006,
         101,
         0,
         99,
     ]
     outputs = solve1(test_prog1, [])
     # Quine
     self.assertEqual(outputs, test_prog1)
Esempio n. 2
0
 def test_jump_2(self):
     program = [3, 3, 1105, -1, 9, 1101, 0, 0, 12, 4, 12, 99, 1]
     self.assertEqual(solve1(program, [0]), [0])
     self.assertEqual(solve1(program, [10]), [1])
Esempio n. 3
0
 def test_jump_1(self):
     program = [3, 12, 6, 12, 15, 1, 13, 14, 13, 4, 13, 99, -1, 0, 1, 9]
     self.assertEqual(solve1(program, [0]), [0])
     self.assertEqual(solve1(program, [10]), [1])
Esempio n. 4
0
 def test_8_4(self):
     program = [3, 3, 1107, -1, 8, 3, 4, 3, 99]
     self.assertEqual(solve1(program, [7]), [1])
     self.assertEqual(solve1(program, [8]), [0])
     self.assertEqual(solve1(program, [9]), [0])
Esempio n. 5
0
 def test_8_2(self):
     program = [3, 9, 7, 9, 10, 9, 4, 9, 99, -1, 8]
     self.assertEqual(solve1(program, [7]), [1])
     self.assertEqual(solve1(program, [8]), [0])
     self.assertEqual(solve1(program, [9]), [0])
Esempio n. 6
0
 def test_part2(self):
     file_data = parse("../../09/input.txt")
     outputs = solve1(file_data, [2])
     self.assertEqual(outputs, [33343])
Esempio n. 7
0
 def test_part1(self):
     file_data = parse("../../09/input.txt")
     outputs = solve1(file_data, [1])
     self.assertEqual(outputs, [3780860499])
Esempio n. 8
0
 def test_prog3(self):
     test_prog3 = [104, 1125899906842624, 99]
     outputs = solve1(test_prog3, [])
     self.assertEqual(outputs, [1125899906842624])
Esempio n. 9
0
 def test_prog2(self):
     test_prog2 = [1102, 34915192, 34915192, 7, 4, 7, 99, 0]
     outputs = solve1(test_prog2, [])
     self.assertEqual(outputs, [1219070632396864])