Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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)
Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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)
Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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])
Ejemplo n.º 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, [])
Ejemplo n.º 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])