Esempio n. 1
0
 @Test
 public void testSetMotorPosition() {
   try {
     motor.setPosition(1.0);
   } catch (MotorPositionOutOfBounds e) {
     fail("The motor attempted to move out of bounds");
   }
   assertEquals(1.0, motor.getPostion(), 0.001);
 }
Esempio n. 2
0
 @Test
 public void testSetMotorPositionMin() {
   try {
     motor.setPosition(0.0);
   } catch (MotorPositionOutOfBounds e) {
     fail("The motor attempted to move out of bounds");
   }
 }
Esempio n. 3
0
  @Test
  public void testSetMotorPositoinDoesntGoOutOfBunds() {
    boolean outOfBounds = false;

    try {
      motor.setPosition(1.1);
    } catch (MotorPositionOutOfBounds e) {
      outOfBounds = true;
    }

    assertTrue(outOfBounds);
    outOfBounds = false;

    try {
      motor.setPosition(-0.1);
    } catch (MotorPositionOutOfBounds e) {
      outOfBounds = true;
    }

    assertTrue(outOfBounds);
  }
Esempio n. 4
0
 @Test
 public void testGetMotorPosition() {
   assertEquals(0.0, motor.getPostion(), 0.001);
 }