public void GotoSameTileTest() { network = new SamplePathNetwork(dataA); IPathNode start = network.GetNode(0, 0); IPathNode goal = network.GetNode(0, 0); Path <SampleNode> p = solver.FindPath(start, goal, network); Assert.AreEqual(PathStatus.ALREADY_THERE, p.status); }
public void DiagonalFind() { network = new SamplePathNetwork(dataA); IPathNode start = network.GetNode(0, 0); IPathNode goal = network.GetNode(9, 9); Path <SampleNode> p = solver.FindPath(start, goal, network); Assert.AreEqual(PathStatus.FOUND_GOAL, p.status); Assert.AreEqual(18, (int)p.pathLength); }
public void EasyMaze() { const string maze = "0,0,0,0,1,0,0,0,0,0," + "1,1,1,0,1,0,0,0,0,0," + "0,0,0,0,1,0,0,0,0,0," + "0,1,1,1,1,0,0,0,0,0," + "0,0,0,0,1,0,0,0,0,0," + "0,0,0,0,1,0,0,0,0,0," + "0,0,0,0,1,0,0,0,0,0," + "0,1,1,1,1,0,0,0,0,0," + "0,0,0,0,0,0,0,0,0,0," + "0,0,0,0,0,1,1,1,0,0,"; const string mazeResult = "x,x,x,x,0,0,0,0,0,0," + "0,0,0,x,0,0,0,0,0,0," + "x,x,x,x,0,0,0,0,0,0," + "x,0,0,0,0,0,0,0,0,0," + "x,0,0,0,0,0,0,0,0,0," + "x,0,0,0,0,0,0,0,0,0," + "x,0,0,0,0,0,0,0,0,0," + "x,0,0,0,0,0,0,0,0,0," + "x,x,x,x,x,x,x,x,x,x," + "0,0,0,0,0,0,0,0,0,x,"; network = new SamplePathNetwork(maze); IPathNode start = network.GetNode(0, 0); IPathNode goal = network.GetNode(9, 9); Path <SampleNode> p = solver.FindPath(start, goal, network); PrintPath(p); Assert.AreEqual(PathStatus.FOUND_GOAL, p.status); Assert.AreEqual(25, (int)p.nodes.Length); Assert.AreEqual(mazeResult, BuildPathString(p)); }