Added another invalid map test case to DFS tests.

This commit is contained in:
Harrison Deng 2020-04-20 17:37:14 -05:00
parent 81fb18ab3d
commit 78cd32106f

View File

@ -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());
}
}