public void AddRoverOutOfBounds() { var grid = new Grid(new Vector(5, 5)); var rover = new Rover(new Vector(8, 2), new Vector(1, 0), "LLM"); var gridString = grid.DebugString(); Assert.IsFalse(grid.AddRover(rover)); Assert.AreEqual(gridString, grid.DebugString()); }
public void AddRoverPositionTaken() { var grid = new Grid(new Vector(5, 5)); var rover = new Rover(new Vector(2, 2), new Vector(1, 0), "LLM"); var rover2 = new Rover(new Vector(2, 2), new Vector(1, 0), "LLM"); Assert.IsTrue(grid.AddRover(rover)); var gridString = grid.DebugString(); Assert.IsFalse(grid.AddRover(rover2)); Assert.AreEqual(gridString, grid.DebugString()); }
public void ParseRoverTest() { var grid = new Grid(new Vector(6, 7)); var rover = new Rover(new Vector(2, 2), new Vector(1, 0), "MLR"); grid.AddRover(rover); var grid2 = new Grid(new Vector(6, 7)); Assert.IsTrue(Parser.ParseRover("2 2 E", "MLR", grid2)); Assert.AreEqual(grid2.DebugString(), grid.DebugString()); }
public void TestUnmovingRover() { var grid = new Grid(new Vector(5, 5)); var rover = new Rover(new Vector(2, 2), new Vector(1, 0), ""); var rover2 = new Rover(new Vector(3, 1), new Vector(0, 1), "LMR"); grid.AddRover(rover); grid.AddRover(rover2); grid.MoveRovers(); var controller = new RoverController(); var result = controller.Debug("5 5\n2 2 E\n\n3 1 N\nLMR"); Assert.AreEqual(grid.DebugString(), result); }
public void ParseGridTest() { var grid = new Grid(new Vector(6, 7)); Assert.AreEqual(Parser.ParseGrid("6 7").DebugString(), grid.DebugString()); }