public void ConstructorTest21()
 {
     global::PathfindingAlgorithms.Algorithms.Astar.Astar astar;
     ManhattanHeuristic s0 = new ManhattanHeuristic();
     StraightAdjacement s1 = new StraightAdjacement();
     astar = this.ConstructorTest((IHeuristic)s0, (IAdjacement)s1);
 }
 public void ProcessTest21203()
 {
     global::PathfindingAlgorithms.Algorithms.Astar.Astar astar;
     IEnumerable<ICell> iEnumerable;
     EuclidianHeuristic s0 = new EuclidianHeuristic();
     StraightAdjacement s1 = new StraightAdjacement();
     astar = AstarFactory.Create((IHeuristic)s0, (IAdjacement)s1);
     ICell[,] iCells = new ICell[1, 1];
     ValueCell s2 = new ValueCell(default(Coordinates), 0);
     iCells[0, 0] = (ICell)s2;
     iEnumerable =
       this.ProcessTest(astar, iCells, default(Coordinates), default(Coordinates));
     Assert.IsNotNull((object)astar);
 }
 public void ProcessTest23301()
 {
     global::PathfindingAlgorithms.Algorithms.Astar.Astar astar;
     IEnumerable<ICell> iEnumerable;
     ManhattanHeuristic s0 = new ManhattanHeuristic();
     StraightAdjacement s1 = new StraightAdjacement();
     astar = AstarFactory.Create((IHeuristic)s0, (IAdjacement)s1);
     ICell[,] iCells = new ICell[1, 2];
     Coordinates s2 = new Coordinates(default(int), 1);
     ValueCell s3 = new ValueCell(default(Coordinates), 1);
     iCells[0, 0] = (ICell)s3;
     Coordinates s5 = new Coordinates(default(int), 1);
     ValueCell s4 = new ValueCell(s5, 0);
     iCells[0, 1] = (ICell)s4;
     iEnumerable = this.ProcessTest(astar, iCells, s2, default(Coordinates));
     Assert.IsNotNull((object)astar);
 }
示例#4
0
        public void StraightAdjacementTest()
        {
            var a = new StraightAdjacement();
            var grid1 = GetEmptyGrid();
            var grid2 = GetCirclesGrid();
            Coordinates corner = new Coordinates(0, 0);
            Coordinates border = new Coordinates(0, grid1.GetLength(1) / 2);
            Coordinates middle1 = new Coordinates(grid1.GetLength(0) / 2, grid1.GetLength(1) / 2);
            Coordinates middle2 = new Coordinates(grid2.GetLength(0) / 2, grid2.GetLength(1) / 2);

            var ways1 = a.Adjacement(grid1, corner);
            var ways2 = a.Adjacement(grid1, border);
            var ways3 = a.Adjacement(grid1, middle1);
            var ways4 = a.Adjacement(grid2, corner);
            var ways5 = a.Adjacement(grid2, middle2);

            Assert.AreEqual(2, ways1.Count(), "empty corner");
            Assert.AreEqual(3, ways2.Count(), "empty border");
            Assert.AreEqual(4, ways3.Count(), "empty middle");
            Assert.AreEqual(0, ways4.Count(), "rounded corner");
            Assert.AreEqual(0, ways5.Count(), "rounded middle");
        }