def test_jumps(self):
     inputs = [('3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9', 0, ['0'], []),
               ('3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9', 0, ['1'], []),
               ('3,3,1105,-1,9,1101,0,0,12,4,12,99,1', 0, ['0'], []),
               ('3,3,1105,-1,9,1101,0,0,12,4,12,99,1', 0, ['1'], [])]
     outputs = [['0'], ['1'], ['0'], ['1']]
     for j, i in enumerate(inputs):
         self.assertEqual(run_to_halt(i)[3], outputs[j])
 def test_full_computer(self):
     inputs = [('109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99',
                0, 0, [], []),
               ('1102,34915192,34915192,7,4,7,99,0', 0, 0, [], []),
               ('104,1125899906842624,99', 0, 0, [], [])]
     outputs = [
         '109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99'.split(
             ','), [str(34915192 * 34915192)], ['1125899906842624']
     ]
     for j, i in enumerate(inputs):
         self.assertEqual(run_to_halt(i)[4], outputs[j])
 def test_inputs_outputs_part2(self):
     inputs = [('3,9,8,9,10,9,4,9,99,-1,8', 0, ['5'], []),
               ('3,9,8,9,10,9,4,9,99,-1,8', 0, ['8'], []),
               ('3,9,8,9,10,9,4,9,99,-1,8', 0, ['9'], []),
               ('3,9,7,9,10,9,4,9,99,-1,8', 0, ['5'], []),
               ('3,9,7,9,10,9,4,9,99,-1,8', 0, ['8'], []),
               ('3,9,7,9,10,9,4,9,99,-1,8', 0, ['9'], []),
               ('3,3,1108,-1,8,3,4,3,99', 0, ['5'], []),
               ('3,3,1108,-1,8,3,4,3,99', 0, ['8'], []),
               ('3,3,1108,-1,8,3,4,3,99', 0, ['9'], [])]
     outputs = [['0'], ['1'], ['0'], ['1'], ['0'], ['0'], ['0'], ['1'],
                ['0']]
     for j, i in enumerate(inputs):
         self.assertEqual(run_to_halt(i)[3], outputs[j])
 def test_terminal_state(self):
     inputs = ['10001,0,0,0,99', '02,3,0,3,99', '10002,4,4,5,99,0']
     outputs = ['20002,0,0,0,99', '02,3,0,6,99', '10002,4,4,5,99,9801']
     for j, i in enumerate(inputs):
         self.assertEqual(','.join([str(i) for i in run_to_halt(i)[0]]),
                          outputs[j])