From 093992ec9916fc77bfdac794c4ea57d5d43f8992 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 25 Mar 2022 23:21:20 +0100 Subject: [PATCH 1/7] fixed small bug in README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 18f16ed..6ea91d7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -#PM2 Team 02 Projekt 1 Racetrack +# PM2 Team 02 Projekt 1 Racetrack Racetrack is a pen and paper game that dates back to the early 1960s in this version of the game, the game is digitalized and the math behind it is done automatically rather than calculated by hand and the winner gets informed automatically as well. The aim of the game is to finish the race faster than your opponent or win by being the only survivor in case the other cars crash. In order to not crash you have to keep in mind the acceleration and other player's car to get to the finish line safely. - +# Testing +#### All test can be run by the terminal command: + gradlew test # Initialization: #### The game can be initialized by the terminal command: - ./gradlew run + gradlew run You will then be prompted to select a track file from the selection by entering the corresponding number. #### For each car that is taking part in the race a strategy has to be chosen there are the following options: From 94fe5c1e53050b5156003ff51e791b0878b8c04e Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 25 Mar 2022 23:22:40 +0100 Subject: [PATCH 2/7] fixed small bug in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ea91d7..7db1fab 100644 --- a/README.md +++ b/README.md @@ -48,4 +48,4 @@ However, the classes that were already given, i.e. not editable, are also in the ![Classdiagram of this program](./Klassendiagramm.svg) ## GitHub Project -Our GitHub Project can be found here: [GitHubProject](./projects/1) +Our GitHub Project can be found here: [GitHubProject](/projects/1) From c041006efbdda4abf4866677620d1cf775015c33 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 25 Mar 2022 23:27:28 +0100 Subject: [PATCH 3/7] fixed small bug in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7db1fab..62350c0 100644 --- a/README.md +++ b/README.md @@ -48,4 +48,4 @@ However, the classes that were already given, i.e. not editable, are also in the ![Classdiagram of this program](./Klassendiagramm.svg) ## GitHub Project -Our GitHub Project can be found here: [GitHubProject](/projects/1) +Our GitHub Project can be found here: [GitHubProject](https://github.zhaw.ch/PM2-IT21bWIN-ruiz-mach-krea/team02-AngryNerds-projekt1-racetrack/projects) From 52d0ace051c58f1cc53a01850dce1116a52547ac Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Fri, 25 Mar 2022 23:38:26 +0100 Subject: [PATCH 4/7] code cleanup --- src/test/java/ch/zhaw/pm2/racetrack/GameTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java b/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java index 9be5d2b..2cae949 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java @@ -160,7 +160,7 @@ class GameTest { */ @Test void winner() { - game = new Game(new interFace("Test",new Integer[]{0,2,0},new PositionVector.Direction[]{RIGHT, + game = new Game(new Interface("Test",new Integer[]{0,2,0},new PositionVector.Direction[]{RIGHT, RIGHT, RIGHT, NONE, @@ -208,7 +208,7 @@ class GameTest { */ @Test void crashA() { - game = new Game(new interFace("Test",new Integer[]{0,1,0},new PositionVector.Direction[]{UP}), new Config()); + game = new Game(new Interface("Test",new Integer[]{0,1,0},new PositionVector.Direction[]{UP}), new Config()); game.initPhase(); Assertions.assertEquals("b",game.gamePhase()); } @@ -218,7 +218,7 @@ class GameTest { */ @Test void passFinishLineInWrongDirection() { - game = new Game(new interFace("Test",new Integer[]{1,0,1},new PositionVector.Direction[]{LEFT,NONE,NONE,RIGHT,RIGHT}), new Config()); + game = new Game(new Interface("Test",new Integer[]{1,0,1},new PositionVector.Direction[]{LEFT,NONE,NONE,RIGHT,RIGHT}), new Config()); game.initPhase(); Assertions.assertEquals("a",game.gamePhase()); } @@ -241,15 +241,15 @@ class GameTest { * This Class is used to communicate with the UserInterface. It overrides crucial methods and returns an instruction based on the instructions' data field. * To implement the right instructions the user has to be aware of the game sequence. */ - private class interFace extends UserInterface { + private class Interface extends UserInterface { private final PositionVector.Direction[] directions; private final Integer[] instructions; private int pointerDir,pointerInstruction; - public interFace(String welcometxt, Integer[] instructions, PositionVector.Direction[] directions) { - super(welcometxt); + public Interface(String welcometext, Integer[] instructions, PositionVector.Direction[] directions) { + super(welcometext); pointerDir = -1; pointerInstruction = -1; this.instructions = instructions; From cec225ea104d31fd3932ff729c176536b84d6e8d Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 25 Mar 2022 23:38:49 +0100 Subject: [PATCH 5/7] checked and added javadocs where needed in CarTest --- .../java/ch/zhaw/pm2/racetrack/CarTest.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/CarTest.java b/src/test/java/ch/zhaw/pm2/racetrack/CarTest.java index 4d274c7..d69692b 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/CarTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/CarTest.java @@ -14,7 +14,9 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.*; /** - * Tests for Class Car + * Class that contains all test for the Class Car + * + * @author Roman Schenk */ class CarTest { @@ -26,7 +28,7 @@ class CarTest { final char DEFAULT_ID = 'f'; /** - * Create a new Car Object and set Position to a defined Default Position + * Creates a new Car Object and set Position to a defined Default Position */ @BeforeEach void setUp() { @@ -34,7 +36,7 @@ class CarTest { } /** - * Checks getID + * Checks if the method getID returns the correct value */ @Test void getID() { @@ -52,8 +54,8 @@ class CarTest { } /** - * - checks if the position of the car can be set and saved correctly with valid positions. - * - checks if an exception is thrown and position keeps unchanged if invalid coordinates are entered. + * Checks if the position of the car can be set and saved correctly with valid positions. + * Checks if an exception is thrown and position kept unchanged if invalid coordinates are entered. */ @Test void setPosition() { @@ -159,7 +161,8 @@ class CarTest { /** - * test for methods crash and isCrashed. checks if state crashed is set and returned correctly. + * Test for methods crash and isCrashed. + * Checks if state crashed is set and returned correctly. */ @Test void crash() { @@ -169,8 +172,8 @@ class CarTest { } /** - * test for methods setMoveStrategy. Checks if the MoveStrategy Object is saved and returned correctly - * with all Types of MoveStrategy. + * Test for methods setMoveStrategy. + * Checks if the MoveStrategy Object is saved and returned correctly with all Types of MoveStrategy. */ @Test void MoveStrategy() { @@ -202,7 +205,7 @@ class CarTest { } /** - * Test for get WinPoints + * Tests if getWinPoints returns the correct value. */ @Test void getWinPoints() { @@ -210,7 +213,7 @@ class CarTest { } /** - * Test for increase WinPoints + * Tests if winpoints increase functions properly. */ @Test void increaseWinPoints() { @@ -219,7 +222,7 @@ class CarTest { } /** - * Test for deduct WinPoints + * Tests if the deductions of winpoints functions properly. */ @Test void deductWinPoints() { From 45cffafb6bd7a6e511dd37300139c1407f99b197 Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Fri, 25 Mar 2022 23:40:41 +0100 Subject: [PATCH 6/7] code cleanup --- .../{MoveStrategyTest.java => MoveListStrategyTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/test/java/ch/zhaw/pm2/racetrack/{MoveStrategyTest.java => MoveListStrategyTest.java} (96%) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/MoveStrategyTest.java b/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java similarity index 96% rename from src/test/java/ch/zhaw/pm2/racetrack/MoveStrategyTest.java rename to src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java index 5796364..28fe8f0 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/MoveStrategyTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java @@ -10,7 +10,7 @@ import java.io.FileNotFoundException; /** * This Class tests the MoveStrategy. */ -public class MoveStrategyTest { +public class MoveListStrategyTest { private MoveStrategy moveList; From b4664cd8540c476ef82e188ec30bcf9853f8d2e4 Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Fri, 25 Mar 2022 23:44:06 +0100 Subject: [PATCH 7/7] Javadoc in MoveListStrategyTest --- .../java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java b/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java index 28fe8f0..88c3f28 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/MoveListStrategyTest.java @@ -14,10 +14,14 @@ public class MoveListStrategyTest { private MoveStrategy moveList; + @Nested @DisplayName("MoveListStrategy") class MoveList { + /** + * Creates a new MoveListStrategy + */ @BeforeEach void setup() { try { @@ -27,6 +31,9 @@ public class MoveListStrategyTest { } } + /** + * Checks if the directions are returned correct by method nextMove + */ @Test void checkMove() { Assertions.assertEquals(PositionVector.Direction.RIGHT,moveList.nextMove());