def test_scenario_3(): robot = robot_sim.Robot() robot.input_parser("PLACE 1,2,EAST") robot.input_parser("MOVE") robot.input_parser("MOVE") robot.input_parser("LEFT") robot.input_parser("MOVE") assert robot.input_parser("REPORT") == (3, 3, "NORTH")
def test_scenario_2(): robot = robot_sim.Robot() robot.input_parser("PLACE 0,0,NORTH") robot.input_parser("LEFT") assert robot.input_parser("REPORT") == (0, 0, "WEST")
def test_scenario_1(): robot = robot_sim.Robot() robot.input_parser("PLACE 0,0,NORTH") robot.input_parser("MOVE") assert robot.input_parser("REPORT") == (0, 1, "NORTH")
def test_multi_place(): robot = robot_sim.Robot() robot.place(3, 3, "east") robot.place(4, 2, "north") robot.place(2, 1, "bad orientation") assert (robot.x_pos, robot.y_pos, robot.orientation) == (4, 2, "north")
def test_off_grid(x, y, orientation): robot = robot_sim.Robot() robot.place(x, y, orientation) assert robot.move() == "Sorry, don't want to fall off!"
def test_bad_commands(bad_command): robot = robot_sim.Robot() assert robot.input_parser(bad_command) == "Oops, try again"
def test_invalid_pos(x, y): robot = robot_sim.Robot() assert robot.validate(x, y) is False
def test_right(starting, expected): robot = robot_sim.Robot() robot.place(0, 0, starting) robot.right() assert robot.orientation == expected
def test_move(x, y, orientation, expected): robot = robot_sim.Robot() robot.place(x, y, orientation) robot.move() robot.move() assert (robot.x_pos, robot.y_pos, robot.orientation) == expected
def test_invalid_place(x, y, orientation): robot = robot_sim.Robot() robot.place(0, 0, "north") robot.place(x, y, orientation) assert (robot.x_pos, robot.y_pos, robot.orientation) == (0, 0, "north")
def test_valid_place(x, y, orientation): robot = robot_sim.Robot() robot.place(x, y, orientation) assert (robot.x_pos, robot.y_pos, robot.orientation) == (x, y, orientation.lower())
def test_valid_pos(x, y): robot = robot_sim.Robot() assert robot.validate(x, y) is True