From 3d62870da344231f22ef01bfa49458777bd8f239 Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:19:14 +0100 Subject: [PATCH 01/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/test/java/SnakeTest.java diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java new file mode 100644 index 0000000..834f65f --- /dev/null +++ b/src/test/java/SnakeTest.java @@ -0,0 +1,9 @@ +class SnakeTest { + + public void testReset() { + + + } + + +} From 1d09714b0e707c69b5141f846001b21d7959afb3 Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:44:58 +0100 Subject: [PATCH 02/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 11 +++++++++++ target/classes/classpath.index | Bin 230 -> 0 bytes target/test-classes/AIGridGUITest.class | Bin 672 -> 1271 bytes target/test-classes/classpath.index | Bin 96 -> 0 bytes 4 files changed, 11 insertions(+) delete mode 100644 target/classes/classpath.index delete mode 100644 target/test-classes/classpath.index diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 834f65f..3695992 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -1,6 +1,17 @@ +import Snake.Snake; + +import java.awt.*; +import java.util.ArrayList; + class SnakeTest { public void testReset() { + int gridSize = 20; + Snake snake = new Snake(gridSize); + snake.reset(); + + ArrayList bodySegments = snake.getBodySegments(); + Snake.SnakeDirection direction = Snake.SnakeDirection.UP; } diff --git a/target/classes/classpath.index b/target/classes/classpath.index deleted file mode 100644 index 674a749cb72a387a028a406035bc08a3d7e87b28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 230 zcmb1OU}0cjU<6_qP-1^jv#RyHMPZbpSdA5L!wg;Cl{2Dqr^Dps_OE*2ciWLW1SY_6 zQ3uXs$e+N#5ac0v1R=t}a7GlF$H4HH)1eU}qET@t0mKsZx^kL<;mTtMhVs+y fDH&lhtAl~TuXAE{(mMu*m2VjsrmZMB$iM&q&L%e( diff --git a/target/test-classes/AIGridGUITest.class b/target/test-classes/AIGridGUITest.class index cc50bade1ca972ed0bb09ec8cc84cd0cbea744bf..073325ff600470d7b2f75da47b7e4737bf6dd72c 100644 GIT binary patch literal 1271 zcmbVL=}r?-6#i~ox;eB%sbwphEOrs<8h=1ZK!r3J)UY)1=d_G)$uLu=Q+zHH1*3@% z;6oX|J1vD05);$(_TF>P{g!i1fB*UM3qTbwk_aIjLqx+6q5}GboZYn)n5 zUm&_J9qDffgbT%b3~_<%mg)PpwSOX8mCf3YCy#axYe~eAR4DfZh6=S>v7W#%QZb}8 z=ok?g?x!ADZQ>?O*?TIGGwy<1Q<$R~vbawfXYRRm*b;~oYDKb*VLXNj4U>v+&h?Hf zryc6#+LFHIRm_&GY_{8$=S$aV3utC=c=M@a+HD1#*D$Ss;|ln-``J;!Sq*b4m{7qz zd3@rl=mQN4{ZzyHNcE9d?vW*sHl$;{?VL3%@4#%>jARVAY1(zulj__HM*I^=4QXSb z25SOiK5MZXINNr;x@pU!n$zm2vU^s$V{;>F0uy^3$CqbTUA84rHyy|I&7QHmakqI@ zWin`249a5fs3fY_Y|7Pb;Ppm!*JVmwzqie1&}=$L?zH5E>VTV7H9DAQ(?c9B z!7tm+HOf6_i|Zm!TimO=Z0QoB^b@fUdQwkbBJmB{7sf+a;;N<+EPMnBEOV!I-{2t% zJP8zu7Ygup`KxkAN?)PrFE5Z;*H@;#BXM_z^Re z)Rll{wNK+wN`$dVr8pj^UPDh-%lQjTZRqLg0lpk90;A;1k~PQOI41Z}MoL|jKCd1W ziGARwLIojaceR9XX?fh&(jbO%G=8IcMmc(cnQAOQpd=Hp Date: Wed, 8 Feb 2023 19:45:59 +0100 Subject: [PATCH 03/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 3695992..8f8a6da 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -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 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); } From c22395d7301faf753757df0f869d7cb6dca24c8e Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:48:58 +0100 Subject: [PATCH 04/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 8f8a6da..cc6f930 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -1,12 +1,14 @@ import Snake.Snake; +import org.junit.jupiter.api.Test; import java.awt.*; import java.util.ArrayList; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; class SnakeTest { - + @Test public void testReset() { int gridSize = 20; Snake snake = new Snake(gridSize); @@ -23,5 +25,9 @@ class SnakeTest { } + @Test + public void testIsSelfColliding() { + + } } From 0f0596821159d3d2d2d6afa166d3fb42341f797c Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:49:51 +0100 Subject: [PATCH 05/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index cc6f930..77a571b 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -27,7 +27,9 @@ class SnakeTest { @Test public void testIsSelfColliding() { + int gridSize = 20; + Snake snake = new Snake(gridSize); - + assertFalse(snake.isSelfColliding()); } } From 2c22c957582aff3aa2d7cc6e8be9cf1a1eb97aca Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:51:16 +0100 Subject: [PATCH 06/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 77a571b..819c86f 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -26,6 +26,13 @@ class SnakeTest { } @Test + public void testUpdate() { + + + } + + + @Test public void testIsSelfColliding() { int gridSize = 20; Snake snake = new Snake(gridSize); From 313ff8e3612d2d5490b2686bd6902013ade97c21 Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:52:52 +0100 Subject: [PATCH 07/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 819c86f..22130a9 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -27,7 +27,9 @@ class SnakeTest { @Test public void testUpdate() { - + int gridSize = 20; + Snake snake = new Snake(gridSize); + snake.reset(); } From 2ecad6f7944a2db24cfaec03df0639bc662c6d13 Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:53:11 +0100 Subject: [PATCH 08/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 22130a9..1658151 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -31,6 +31,12 @@ class SnakeTest { Snake snake = new Snake(gridSize); snake.reset(); + snake.setDirection(Snake.SnakeDirection.UP); + snake.update(); + ArrayList bodySegments = snake.getBodySegments(); + assertEquals(new Point(gridSize / 2, gridSize / 2 - 1), bodySegments.get(0)); + assertEquals(new Point(gridSize / 2, gridSize / 2), bodySegments.get(1)); + } From 0c5cfb17b5f12c12457419249ed705998a6136b0 Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:53:37 +0100 Subject: [PATCH 09/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 1658151..9242420 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -37,6 +37,12 @@ class SnakeTest { assertEquals(new Point(gridSize / 2, gridSize / 2 - 1), bodySegments.get(0)); assertEquals(new Point(gridSize / 2, gridSize / 2), bodySegments.get(1)); + snake.setDirection(Snake.SnakeDirection.RIGHT); + snake.update(); + bodySegments = snake.getBodySegments(); + assertEquals(new Point(gridSize / 2 + 1, gridSize / 2 - 1), bodySegments.get(0)); + assertEquals(new Point(gridSize / 2, gridSize / 2 - 1), bodySegments.get(1)); + } From a8c65719b20f8a33f912822c6c64eded04025099 Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:53:54 +0100 Subject: [PATCH 10/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 9242420..7a13ec1 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -43,6 +43,12 @@ class SnakeTest { assertEquals(new Point(gridSize / 2 + 1, gridSize / 2 - 1), bodySegments.get(0)); assertEquals(new Point(gridSize / 2, gridSize / 2 - 1), bodySegments.get(1)); + snake.setDirection(Snake.SnakeDirection.DOWN); + snake.update(); + bodySegments = snake.getBodySegments(); + assertEquals(new Point(gridSize / 2 + 1, gridSize / 2), bodySegments.get(0)); + assertEquals(new Point(gridSize / 2 + 1, gridSize / 2 - 1), bodySegments.get(1)); + } From 4a307176f2c590aeef1f2fc9280a6a2f1052791b Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:54:28 +0100 Subject: [PATCH 11/12] Update Unit Test Snake --- src/test/java/SnakeTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 7a13ec1..4d18755 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -49,6 +49,12 @@ class SnakeTest { assertEquals(new Point(gridSize / 2 + 1, gridSize / 2), bodySegments.get(0)); assertEquals(new Point(gridSize / 2 + 1, gridSize / 2 - 1), bodySegments.get(1)); + snake.setDirection(Snake.SnakeDirection.LEFT); + snake.update(); + bodySegments = snake.getBodySegments(); + assertEquals(new Point(gridSize / 2, gridSize / 2), bodySegments.get(0)); + assertEquals(new Point(gridSize / 2 + 1, gridSize / 2), bodySegments.get(1)); + } From 13807297fbaf26e837cb800f0b7a42d59e3b3529 Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Wed, 8 Feb 2023 19:59:10 +0100 Subject: [PATCH 12/12] Final Update Unit Test Snake --- src/test/java/SnakeTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/java/SnakeTest.java b/src/test/java/SnakeTest.java index 4d18755..6c79afc 100644 --- a/src/test/java/SnakeTest.java +++ b/src/test/java/SnakeTest.java @@ -55,6 +55,9 @@ class SnakeTest { assertEquals(new Point(gridSize / 2, gridSize / 2), bodySegments.get(0)); assertEquals(new Point(gridSize / 2 + 1, gridSize / 2), bodySegments.get(1)); + snake.setDirection(Snake.SnakeDirection.UP); + snake.update(); + }