|
|
@ -3,6 +3,8 @@ import Snake.Snake; |
|
|
|
import java.awt.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
|
|
|
|
|
class SnakeTest { |
|
|
|
|
|
|
|
public void testReset() { |
|
|
@ -13,6 +15,11 @@ class SnakeTest { |
|
|
|
ArrayList<Point> bodySegments = snake.getBodySegments(); |
|
|
|
Snake.SnakeDirection direction = Snake.SnakeDirection.UP; |
|
|
|
|
|
|
|
assertEquals(3, bodySegments.size()); |
|
|
|
assertEquals(new Point(gridSize / 2, gridSize / 2), bodySegments.get(0)); |
|
|
|
assertEquals(new Point(gridSize / 2, gridSize / 2 + 1), bodySegments.get(1)); |
|
|
|
assertEquals(new Point(gridSize / 2, gridSize / 2 + 2), bodySegments.get(2)); |
|
|
|
assertEquals(Snake.SnakeDirection.UP, direction); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|