def test_advance(self): robot = Robot(7, 3, 'north') self.assertEqual(robot.advance(), (7, 4, 'north')) self.assertEqual(robot.advance(), (7, 5, 'north'))
def test_initialization(self): robot = Robot(7, 3, 'north') self.assertEqual(robot.x, 7) self.assertEqual(robot.y, 3) self.assertEqual(robot.direction, 'north')
def test_get_position(self): robot = Robot(7, 3, 'north') self.assertEqual(robot.get_position(), (7, 3, 'north'))
def test_turn_left(self): robot = Robot(7, 3, 'north') self.assertEqual(robot.turn_left(), 'west') self.assertEqual(robot.turn_left(), 'south') self.assertEqual(robot.turn_left(), 'east') self.assertEqual(robot.turn_left(), 'north')
def test_t_right(self): robot = Robot("T") self.assertEqual(robot.turn_right(), "R")
def test_r_down(self): robot = Robot("R") self.assertEqual(robot.turn_right(), "D")
def test_l_down(self): robot = Robot("L") self.assertEqual(robot.turn_left(), "D")
def test_l_right(self): robot = Robot("D") self.assertEqual(robot.turn_left(), "R")
def test_l_top(self): robot = Robot("R") self.assertEqual(robot.turn_left(), "T")
def test_l_left(self): robot = Robot("T") self.assertEqual(robot.turn_left(), "L")
def test_r_top(self): robot = Robot("L") self.assertEqual(robot.turn_right(), "T")