Example #1
0
        public void GetSensorRobotPosition_Should_Return_Position_For_ProximitySensor()
        {
            var exploredMap = new ExploredMap(new Vector2Int(30, 30), new Vector2Int(1, 1));
            var array       = new int[3, 3] {
                { -1, 1, -1 }, { 1, 2, 1 }, { -1, 0, -1 }
            };                                                               //Data like proximity sensor
            var result = exploredMap.GetSensorRobotPosition(array);

            Assert.That(result, Is.EqualTo(new Vector2Int(1, 1)));
        }
Example #2
0
        public void GetSensorRobotPosition_Should_Return_OneOne_For_FiveByFiveSensor()
        {
            ExploredMap exploredMap = new ExploredMap(new Vector2Int(30, 30), new Vector2Int(1, 1));

            int[,] sensorData = { { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 2, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 } };
            Vector2Int result   = exploredMap.GetSensorRobotPosition(sensorData);
            Vector2Int expected = new Vector2Int(2, 2);

            Assert.That(result, Is.EqualTo(expected));
        }