public void MaximumSpacesVisited() { int x = -100000, y = -100000; CleaningRobot robot = CreateTesterRobot(x, y); List <(string, int)> commands = new List <(string, int)> { ("E", 100000), ("N", 100000), ("W", 100000), }; int z = 99998; int num = 9997; while (num > 0) { commands.Add(("S", z)); commands.Add(("E", z)); z--; commands.Add(("N", z)); commands.Add(("W", z)); z--; num--; } robot.RunRobot(commands); }
public void RunCleaningRobot_NoMovement() { int x = 12, y = 13; List <(string, int)> commands = new List <(string, int)> { ("E", 0) }; CleaningRobot robot = CreateTesterRobot(x, y); int spacesCleaned = robot.RunRobot(commands); Assert.AreEqual(1, spacesCleaned); Assert.AreEqual(12, robot.XCoordinate); Assert.AreEqual(13, robot.YCoordinate); }
public void RunCleaningRobot_Circle() { int x = 0, y = 0; List <(string, int)> commands = new List <(string, int)> { ("E", 1), ("N", 1), ("W", 1), ("S", 1), ("E", 1), ("N", 1), ("W", 1), ("S", 1) }; CleaningRobot robot = CreateTesterRobot(x, y); int spacesCleaned = robot.RunRobot(commands); Assert.AreEqual(4, spacesCleaned); Assert.AreEqual(x, robot.XCoordinate); Assert.AreEqual(y, robot.YCoordinate); }
public void RunCleaningRobot_LargeCommandsList() { int x = -100000, y = -100000; List <(string, int)> commands = new List <(string, int)> { ("E", 100000), ("N", 100000), ("W", 100000), ("S", 99999), ("E", 99999), ("N", 99998), ("W", 99997), ("S", 99996) }; CleaningRobot robot = CreateTesterRobot(x, y); int spacesCleaned = robot.RunRobot(commands); Assert.AreEqual(799990, spacesCleaned); Assert.AreEqual(-99998, robot.XCoordinate); Assert.AreEqual(-99997, robot.YCoordinate); }