Exemple #1
0
 def test_wait(self):
     code = [3, 3, 99, 0]
     amplifier = Amplifier(code)
     status, signal = amplifier.execute()
     self.assertEqual(status, 'WAITING')
     self.assertEqual(signal, None)
     status, signal = amplifier.execute(10)
     self.assertEqual(status, 'HALT')
     self.assertEqual(signal, None)
Exemple #2
0
 def test_sample_9(self):
     code = [3, 3, 1107, -1, 8, 3, 4, 3, 99]
     amplifier = Amplifier(code)
     status, signal = amplifier.execute(0)
     self.assertEqual(status, 'OUTPUT')
     self.assertEqual(signal, 1)
     status, signal = amplifier.execute()
     self.assertEqual(status, 'HALT')
     self.assertEqual(signal, None)
Exemple #3
0
 def test_sample_11(self):
     code = [3, 12, 6, 12, 15, 1, 13, 14, 13, 4, 13, 99, -1, 0, 1, 9]
     amplifier = Amplifier(code)
     status, signal = amplifier.execute(1)
     self.assertEqual(status, 'OUTPUT')
     self.assertEqual(signal, 1)
     status, signal = amplifier.execute()
     self.assertEqual(status, 'HALT')
     self.assertEqual(signal, None)
Exemple #4
0
 def test_io(self):
     code = [3, 9, 1002, 9, 2, 10, 4, 10, 99, 0, 0]
     amplifier = Amplifier(code)
     status, signal = amplifier.execute(3)
     self.assertEqual(status, 'OUTPUT')
     self.assertEqual(signal, 6)
     status, signal = amplifier.execute()
     self.assertEqual(status, 'HALT')
     self.assertEqual(signal, None)