Esempio n. 1
0
        public void ASearchingAlgorithm_ConstructorTest()
        {
            IHeuristic          AirDistance = new MazeAirDistance();
            ASearchingAlgorithm astarAir    = new Astar(AirDistance);

            Assert.IsNotNull(astarAir);
            Assert.IsNotNull(AirDistance);
            Assert.IsInstanceOfType(astarAir, typeof(ASearchingAlgorithm));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
            }
        }