From 95ef0b9d767ee3c82f3a14a1869806ce5a44400b Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Thu, 24 Mar 2022 18:33:29 +0100 Subject: [PATCH] refactor gametest --- src/main/java/ch/zhaw/pm2/racetrack/Game.java | 1 - src/main/java/ch/zhaw/pm2/racetrack/Track.java | 2 +- src/test/java/ch/zhaw/pm2/racetrack/GameTest.java | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index 05698c0..b7715fa 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -290,7 +290,6 @@ public class Game implements GameSpecification { * If the car is passing the finishline in the correct direction, the car will gain a winpoint. * @param start the startposition of the car * @param finish the expected finishpositon of the car after the move - * @param carIndex of the current player. */ private void calculateWinner(PositionVector start, PositionVector finish, int carIndex) { List path = calculatePath(start, finish); diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Track.java b/src/main/java/ch/zhaw/pm2/racetrack/Track.java index f7eee0e..37c1493 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Track.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Track.java @@ -284,7 +284,7 @@ public class Track implements TrackSpecification { } } - return null; + return ConfigSpecification.SpaceType.WALL; } /** diff --git a/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java b/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java index 4aca662..77b9148 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java @@ -133,7 +133,7 @@ class GameTest { @Test void winner() { - game = new Game(new interFace("Test",new Integer[]{0,2,1},new PositionVector.Direction[]{RIGHT, + game = new Game(new interFace("Test",new Integer[]{0,2,0},new PositionVector.Direction[]{RIGHT, RIGHT, RIGHT, NONE, @@ -178,7 +178,7 @@ class GameTest { @Test void crashA() { - game = new Game(new interFace("Test",new Integer[]{0,2,2},new PositionVector.Direction[]{UP})); + game = new Game(new interFace("Test",new Integer[]{0,1,1},new PositionVector.Direction[]{UP})); game.initPhase(); Assertions.assertEquals("b",game.gamePhase()); } @@ -187,8 +187,8 @@ class GameTest { private class interFace extends UserInterface { - private final PositionVector.Direction[] directions; - private final Integer[] instructions; + private PositionVector.Direction[] directions; + private Integer[] instructions; private int pointerDir,pointerInstruction;