From 1c4a92f325f7390d07dfcf13ac59f8a58854fabe Mon Sep 17 00:00:00 2001 From: Yashica <158531206+cokeisthebest@users.noreply.github.com> Date: Tue, 30 Apr 2024 23:56:07 -0500 Subject: [PATCH] Update GridTest.java --- .../java/com/group23/wurdle/GridTest.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/test/java/com/group23/wurdle/GridTest.java b/src/test/java/com/group23/wurdle/GridTest.java index 69191ad..63b0801 100644 --- a/src/test/java/com/group23/wurdle/GridTest.java +++ b/src/test/java/com/group23/wurdle/GridTest.java @@ -161,4 +161,46 @@ public void gridUnder1Second() throws Exception { } + + @Test + public void testWordExistsHorizontal() { + // Create a new grid + Grid grid = new Grid(5, 5); + // Create a GridGen object + GridGen generator = new GridGen(); + generator.addWordToGrid("TEST", grid); + assertTrue(GridGen.wordExists("TEST", grid)); // Verify if the word "TEST" exists horizontally in the grid + } + + @Test + public void testWordExistsVertical() { + // Create a new grid + Grid grid = new Grid(5, 5); + // Create a GridGen object + GridGen generator = new GridGen(); + generator.addWordToGrid("TEST", grid); + assertTrue(GridGen.wordExists("TEST", grid)); // Verify if the word "TEST" exists vertically in the grid + } + + @Test + public void testWordExistsDiagonalUp() { + // Create a new grid + Grid grid = new Grid(5, 5); + // Create a GridGen object + GridGen generator = new GridGen(); + generator.addWordToGrid("TEST", grid); + assertTrue(GridGen.wordExists("TEST", grid)); // Verify if the word "TEST" exists diagonally up in the grid + } + + @Test + public void testWordExistsDiagonalDown() { + // Create a new grid + Grid grid = new Grid(5, 5); + // Create a GridGen object + GridGen generator = new GridGen(); + generator.addWordToGrid("TEST", grid); + assertTrue(GridGen.wordExists("TEST", grid)); // Verify if the word "TEST" exists diagonally down in the grid + } + + }