Ejemplo n.º 1
0
 def test_move_right(self, motor : Motor) :
     position_before = 0
     velocity_before = 0.0
     motor.move_right(False)
     while True :
         self.assertTrue(motor.moving)
         position = motor.position
         acceleration = motor.acceleration
         velocity = motor.velocity
         self.assertGreaterEqual(position, position_before)
         self.assertGreaterEqual(velocity, velocity_before)
         self.assertGreater(velocity, 0.0)
         position_before = position
         velocity_before = velocity
         if +velocity == motor.velocity_moving :
             break
         self.assertEqual(acceleration, motor.acceleration_moving)
     self.assertTrue(motor.moving)
     self.assertEqual(motor.velocity, +motor.velocity_moving)
     motor.stop(False)
     # Expects no overshoot.
     while True :
         acceleration = motor.acceleration
         velocity = motor.velocity
         position = motor.position
         moving = motor.moving
         if moving :
             self.assertGreater(velocity, 0.0)
             self.assertEqual(acceleration, -motor.acceleration_moving)
         self.assertLessEqual(velocity, velocity_before)
         self.assertGreaterEqual(position, position_before)
         velocity_before = velocity
         position_before = position
         if not moving :
             break
     self.__test_stopped(motor)
Ejemplo n.º 2
0
 def test_stop_right(self, motor : Motor) :
     motor.move_right(False)
     while motor.velocity < +motor.velocity_moving :
         pass
     motor.stop()
     self.__test_stopped(motor)