public void InsideRangeObstacleTest() { obstacleMap = new ObstacleMap(); Obstacle obstacle = new Obstacle(new Vector(-100, 100), new Vector(100, 100)); obstacleMap.AddObstacle(obstacle); Vector result = obstacleMap.GetRouteSuggestion(new Vector(0, 1)).Item1; Assert.IsTrue(result.X <-0.998f && result.X> -1.005f); }
public void BetweenObstaclesTest_WideSpace() { obstacleMap = new ObstacleMap(); Obstacle obstacleLeft = new Obstacle(new Vector(-800, 500), new Vector(-400, 500)); Obstacle obstacleRight = new Obstacle(new Vector(400, 1000), new Vector(800, 1000)); obstacleMap.AddObstacle(obstacleLeft); obstacleMap.AddObstacle(obstacleRight); Vector result = obstacleMap.GetRouteSuggestion(new Vector(0, 1)).Item1; Assert.IsTrue(result.Y > 0.995f && result.Y < 1.005f); }
public void BetweenObstaclesTest_NarrowSpace() { obstacleMap = new ObstacleMap(); Obstacle obstacleLeft = new Obstacle(new Vector(-1000, 500), new Vector(-200, 500)); Obstacle obstacleRight = new Obstacle(new Vector(200, 500), new Vector(1000, 500)); obstacleMap.AddObstacle(obstacleLeft); obstacleMap.AddObstacle(obstacleRight); Vector result = obstacleMap.GetRouteSuggestion(new Vector(0, 1)).Item1; Assert.IsTrue(result.X <-0.998f && result.X> -1.005f); }
public void AvoidDirectObstacleTest() { obstacleMap = new ObstacleMap(); Obstacle obstacle = new Obstacle(new Vector(-500, 1000), new Vector(500, 1000)); obstacleMap.AddObstacle(obstacle); Vector result = obstacleMap.GetRouteSuggestion(new Vector(0, 1)).Item1; Assert.IsTrue(result.Y > 0.79f && result.Y < 0.81f); Assert.IsTrue(result.X > -0.59f && result.X < -0.57f); Assert.IsTrue(result.Length > 0.999 && result.Length < 1.001); }