Tested DFS direction assisted search.
This commit is contained in:
@@ -99,7 +99,7 @@ public class DepthFirstSearchTest {
|
||||
{
|
||||
dfs.setValidatable(new Validator(mapA));
|
||||
dfs.setStartPosition(1, 2);
|
||||
dfs.setEndPosition(1, 0);
|
||||
dfs.setDirectionPosition(1, 0);
|
||||
assertTrue(dfs.buildPathToEndNode());
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class DepthFirstSearchTest {
|
||||
{
|
||||
dfs.setValidatable(new Validator(mapB));
|
||||
dfs.setStartPosition(3, 0);
|
||||
dfs.setEndPosition(3, 2);
|
||||
dfs.setDirectionPosition(3, 2);
|
||||
assertTrue(dfs.buildPathToEndNode());
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class DepthFirstSearchTest {
|
||||
{
|
||||
dfs.setValidatable(new Validator(mapD));
|
||||
dfs.setStartPosition(0, 0);
|
||||
dfs.setEndPosition(0, 3);
|
||||
dfs.setDirectionPosition(0, 3);
|
||||
assertTrue(dfs.buildPathToEndNode());
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class DepthFirstSearchTest {
|
||||
{
|
||||
dfs.setValidatable(new Validator(mapC));
|
||||
dfs.setStartPosition(3, 0);
|
||||
dfs.setEndPosition(3, 2);
|
||||
dfs.setDirectionPosition(3, 2);
|
||||
assertFalse(dfs.buildPathToEndNode());
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class DepthFirstSearchTest {
|
||||
{
|
||||
dfs.setValidatable(new Validator(mapE));
|
||||
dfs.setStartPosition(3, 0);
|
||||
dfs.setEndPosition(3, 2);
|
||||
dfs.setDirectionPosition(3, 2);
|
||||
assertFalse(dfs.buildPathToEndNode());
|
||||
}
|
||||
|
||||
@@ -211,4 +211,16 @@ public class DepthFirstSearchTest {
|
||||
|
||||
assertFalse(dfs.findTarget(validator));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDFSFindEndNodeMapHWithAssistValid() {
|
||||
Validator validator = new Validator(mapH);
|
||||
dfs.setValidatable(validator);
|
||||
dfs.setStartPosition(3, 0);
|
||||
dfs.setDirectionPosition(42, 84);
|
||||
|
||||
assertTrue(dfs.findTarget(validator));
|
||||
assertEquals(95, dfs.getEndX());
|
||||
assertEquals(49, dfs.getEndY());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user