public void ASearchingAlgorithm_ConstructorTest() { IHeuristic AirDistance = new MazeAirDistance(); ASearchingAlgorithm astarAir = new Astar(AirDistance); Assert.IsNotNull(astarAir); Assert.IsNotNull(AirDistance); Assert.IsInstanceOfType(astarAir, typeof(ASearchingAlgorithm)); }
public void Equals_Obj_Test_Matching_Same_Solotion() { IHeuristic AirDistance = new MazeAirDistance(); ASearchingAlgorithm astarAir = new Astar(AirDistance); MazeGenerator DfsMazeGenerator = new DfsMazeGenerator(); maze Dfs = DfsMazeGenerator.generatMaze(20, 20); ISearchable SearchableMaze = new SearchableMaze(Dfs, false); Solution target = astarAir.Solve(SearchableMaze); Solution inObject = astarAir.Solve(SearchableMaze); bool expected = true; bool actual = target.GetSolutionPath().Capacity.Equals(inObject.GetSolutionPath().Capacity); Assert.AreEqual(expected, actual); }
public void Equals_Sol_Test_null() { IHeuristic AirDistance = new MazeAirDistance(); ASearchingAlgorithm astarAir = new Astar(AirDistance); MazeGenerator DfsMazeGenerator = new DfsMazeGenerator(); maze Dfs = DfsMazeGenerator.generatMaze(20, 20); ISearchable SearchableMazeA = new SearchableMaze(Dfs, false); ISearchable SearchableMazeB = new SearchableMaze(Dfs, true); Solution target = astarAir.Solve(SearchableMazeA); Solution inObject = astarAir.Solve(SearchableMazeB); bool expected = false; bool actual = target.Equals(inObject); Assert.AreEqual(expected, actual); }
public void Run100() { IHeuristic AirDistance = new MazeAirDistance(); ASearchingAlgorithm astarAir = new Astar(AirDistance); MazeGenerator DfsMazeGenerator = new DfsMazeGenerator(); maze Dfs = DfsMazeGenerator.generatMaze(20, 20); ISearchable SearchableMaze = new SearchableMaze(Dfs, true); Solution inObject = astarAir.Solve(SearchableMaze); Solution target; bool expected = true; for (int i = 0; i < 100; i++) { target = astarAir.Solve(SearchableMaze); bool actual = target.GetSolutionPath().Capacity.Equals(inObject.GetSolutionPath().Capacity); Assert.AreEqual(expected, actual); } }