Exemple #1
0
 def test_advance(self):
     robot = Robot(7, 3, 'north')
     self.assertEqual(robot.advance(), (7, 4, 'north'))
     self.assertEqual(robot.advance(), (7, 5, 'north'))
Exemple #2
0
 def test_initialization(self):
     robot = Robot(7, 3, 'north')
     self.assertEqual(robot.x, 7)
     self.assertEqual(robot.y, 3)
     self.assertEqual(robot.direction, 'north')
Exemple #3
0
 def test_get_position(self):
     robot = Robot(7, 3, 'north')
     self.assertEqual(robot.get_position(), (7, 3, 'north'))
Exemple #4
0
 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')
Exemple #5
0
 def test_t_right(self):
     robot = Robot("T")
     self.assertEqual(robot.turn_right(), "R")
Exemple #6
0
 def test_r_down(self):
     robot = Robot("R")
     self.assertEqual(robot.turn_right(), "D")
Exemple #7
0
 def test_l_down(self):
     robot = Robot("L")
     self.assertEqual(robot.turn_left(), "D")
Exemple #8
0
 def test_l_right(self):
     robot = Robot("D")
     self.assertEqual(robot.turn_left(), "R")
Exemple #9
0
 def test_l_top(self):
     robot = Robot("R")
     self.assertEqual(robot.turn_left(), "T")
Exemple #10
0
 def test_l_left(self):
     robot = Robot("T")
     self.assertEqual(robot.turn_left(), "L")
Exemple #11
0
 def test_r_top(self):
     robot = Robot("L")
     self.assertEqual(robot.turn_right(), "T")