|
@ -31,6 +31,12 @@ class SnakeTest { |
|
|
Snake snake = new Snake(gridSize); |
|
|
Snake snake = new Snake(gridSize); |
|
|
snake.reset(); |
|
|
snake.reset(); |
|
|
|
|
|
|
|
|
|
|
|
snake.setDirection(Snake.SnakeDirection.UP); |
|
|
|
|
|
snake.update(); |
|
|
|
|
|
ArrayList<Point> bodySegments = snake.getBodySegments(); |
|
|
|
|
|
assertEquals(new Point(gridSize / 2, gridSize / 2 - 1), bodySegments.get(0)); |
|
|
|
|
|
assertEquals(new Point(gridSize / 2, gridSize / 2), bodySegments.get(1)); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|