Esempio n. 1
0
        public void ProcessSensor_Should_Add_GivenSensorFiveByFiveSensorData_To_ExploredMap()
        {
            ExploredMap exploredMap = new ExploredMap(new Vector2Int(30, 30), new Vector2Int(2, 2));

            int[,] sensorData =
            {
                { -1, -1, -1, -1, -1 },
                { -1,  1,  0,  1, -1 },
                { -1,  0,  2,  1, -1 },
                { -1,  0,  0,  1, -1 },
                { -1,  1,  0,  1,  1 }
            };
            exploredMap.ProcessSensor(sensorData);
            int[,] expectedData =
            {
                { -1, -1, -1, -1, -1 },
                { -1,  1,  0,  1, -1 },
                { -1,  0,  2,  1, -1 },
                { -1,  0,  0,  1, -1 },
                { -1,  1,  0,  1,  1 }
            };
            var mazeArray = exploredMap.GetMazeArray();
            var saveData  = new int[5, 5];

            for (var i = 0; i < 5; i++)
            {
                for (var j = 0; j < 5; j++)
                {
                    saveData[i, j] = mazeArray[i, j];
                }
            }
            Assert.That(expectedData, Is.EqualTo(saveData));
        }
Esempio n. 2
0
        public void ProcessSensor_Should_Add_GivenSensorThreeByThreeSensorData_To_ExploredMap()
        {
            ExploredMap exploredMap = new ExploredMap(new Vector2Int(30, 30), new Vector2Int(1, 1));

            int[,] sensorData = { { -1, 1, 0 }, { 0, 2, 1 }, { -1, -1, 1 } };
            exploredMap.ProcessSensor(sensorData);
            var mazeArray = exploredMap.GetMazeArray();
            var saveData  = new int[3, 3];

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    saveData[i, j] = mazeArray[i, j];
                }
            }
            Assert.That(sensorData, Is.EqualTo(saveData));
        }