From 78cd32106f464241b3b84cce0b28c4817dd52c15 Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 20 Apr 2020 17:37:14 -0500 Subject: [PATCH] Added another invalid map test case to DFS tests. --- .../pathfinding/DepthFirstSearchTest.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/java/ca/recrown/islandsurvivalcraft/pathfinding/DepthFirstSearchTest.java b/src/test/java/ca/recrown/islandsurvivalcraft/pathfinding/DepthFirstSearchTest.java index cebaac3..6c71543 100644 --- a/src/test/java/ca/recrown/islandsurvivalcraft/pathfinding/DepthFirstSearchTest.java +++ b/src/test/java/ca/recrown/islandsurvivalcraft/pathfinding/DepthFirstSearchTest.java @@ -52,6 +52,13 @@ public class DepthFirstSearchTest extends TestCase {true, false, false, false}, }; + private boolean[][] mapE = new boolean[][] { + {true, true, true, true}, + {false, false, false, false}, + {true, true, true, true}, + {true, false, false, false}, + }; + /** * Create the test case * @@ -88,16 +95,25 @@ public class DepthFirstSearchTest extends TestCase dfs.Setup(3, 2, 3, 0); assertTrue(dfs.buildTree()); } + public void testDFSMapDValid() { DepthFirstSearch dfs = new DepthFirstSearch(new Validator(mapD)); dfs.Setup(0, 3, 0, 0); assertTrue(dfs.buildTree()); } - public void testDFSInvalid() + + public void testDFSMapCInvalid() { DepthFirstSearch dfs = new DepthFirstSearch(new Validator(mapC)); dfs.Setup(3, 2, 3, 0); assertFalse(dfs.buildTree()); } + + public void testDFSMapEInvalid() + { + DepthFirstSearch dfs = new DepthFirstSearch(new Validator(mapE)); + dfs.Setup(3, 2, 3, 0); + assertFalse(dfs.buildTree()); + } }