Ejemplo n.º 1
0
 @Test
 public void testMoveHorizontal() {
   Worm worm = facade.createWorm(world, 1, 2, 0, 1, "Test");
   facade.move(worm);
   assertEquals(2, facade.getX(worm), EPS);
   assertEquals(2, facade.getY(worm), EPS);
 }
Ejemplo n.º 2
0
 @Test
 public void testMoveVertical() {
   Worm worm = facade.createWorm(world, 1, 1.5, Math.PI / 2, 0.5, "Test");
   facade.move(worm);
   assertEquals(1, facade.getX(worm), EPS);
   assertEquals(2.0, facade.getY(worm), EPS);
 }
 @Test
 public void testMoveVertical() {
   Worm worm = facade.createWorm(0, 0, Math.PI / 2, 1, "Test");
   facade.move(worm, 5);
   assertEquals(0, facade.getX(worm), EPS);
   assertEquals(5, facade.getY(worm), EPS);
 }
Ejemplo n.º 4
0
 @Test
 public void testMoveVerticalAlongTerrain() {
   // . . X
   // . w X
   World world =
       facade.createWorld(
           3.0, 2.0, new boolean[][] {{true, true, false}, {true, true, false}}, random);
   Worm worm = facade.createWorm(world, 1.5, 0.5, Math.PI / 2 - 10 * 0.0175, 0.5, "Test");
   facade.move(worm);
   assertEquals(1.5, facade.getX(worm), EPS);
   assertEquals(1.0, facade.getY(worm), EPS);
 }
Ejemplo n.º 5
0
 @Test
 public void testFall() {
   // . X .
   // . w .
   // . . .
   // X X X
   World world =
       facade.createWorld(
           3.0,
           4.0,
           new boolean[][] {
             {true, false, true}, {true, true, true},
             {true, true, true}, {false, false, false}
           },
           random);
   Worm worm = facade.createWorm(world, 1.5, 2.5, (3.0 * Math.PI) / 2.0, 0.5, "Test");
   assertFalse(facade.canFall(worm));
   facade.move(worm);
   assertTrue(facade.canFall(worm));
   facade.fall(worm);
   assertEquals(1.5, facade.getX(worm), EPS);
   assertTrue(1.5 <= facade.getY(worm) && facade.getY(worm) <= 1.55);
 }