@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); }
@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); }