コード例 #1
0
 def test_not_command_another_number(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(56)
     comm.not_command('val')
     self.assertEqual(comm.stack, [0])
コード例 #2
0
 def test_multiply_negative_meaning(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(2)
     comm.stack.append(-6)
     comm.multiply('val')
     self.assertEqual(comm.stack, [-12])
コード例 #3
0
 def test_multiply_empty_stack(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(6)
     first_stack = comm.stack
     comm.multiply('val')
     self.assertEqual(comm.stack, first_stack)
コード例 #4
0
 def test_multiply(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(4)
     comm.stack.append(3)
     comm.multiply('val')
     self.assertEqual(comm.stack, [12])
コード例 #5
0
 def test_subtract_negative_meaning(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(2)
     comm.stack.append(6)
     comm.subtract('val')
     self.assertEqual(comm.stack, [-4])
コード例 #6
0
 def test_add(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(5)
     comm.stack.append(6)
     comm.add('val')
     self.assertEqual(comm.stack, [11])
コード例 #7
0
 def test_pop(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(0)
     len_stack = len(comm.stack)
     comm.pop('val')
     self.assertEqual(len(comm.stack), len_stack - 1)
コード例 #8
0
 def test_greater(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(4)
     comm.stack.append(8)
     comm.greater('val')
     self.assertEqual(comm.stack, [0])
コード例 #9
0
 def test_divide(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.stack.append(6)
     comm.stack.append(3)
     comm.divide('val')
     self.assertEqual(comm.stack, [2])
コード例 #10
0
 def test_push_empty(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.push(None)
     self.assertEqual(comm.stack, [None])
コード例 #11
0
 def test_greater_empty_stack(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.greater('val')
     self.assertEqual(comm.stack, [])
コード例 #12
0
 def test_push_int(self):
     dp = direction.DirectionPointer()
     cc = direction.CodelChooser()
     comm = commands.Commands(dp, cc)
     comm.push(5)
     self.assertEqual(comm.stack, [5])