Пример #1
0
 def test_10_move_vertical_S(self):
     test_bot = RobotController(
         fix_input_grid("5 5"),
         fix_input_start_pos("3 3 S"),
         fix_input_moves("RFLFFLRF"),
     )
     test_bot.vertical_move()
     self.assertEqual(test_bot.current_row, 4)
Пример #2
0
 def test_8_move_horizontal_W(self):
     test_bot = RobotController(
         fix_input_grid("5 5"),
         fix_input_start_pos("2 0 W"),
         fix_input_moves("RFLFFLRF"),
     )
     test_bot.vertical_move()
     self.assertEqual(test_bot.current_column, 2)
Пример #3
0
 def test_7_move_horizontal_E(self):
     test_bot = RobotController(
         fix_input_grid("5 5"),
         fix_input_start_pos("0 0 E"),
         fix_input_moves("RFLFFLRF"),
     )
     test_bot.horizontal_move()
     self.assertEqual(test_bot.current_column, 1)
Пример #4
0
 def test_5_turn_left(self):
     test_bot = RobotController(
         fix_input_grid("5 5"),
         fix_input_start_pos("0 0 E"),
         fix_input_moves("RFLFFLRF"),
     )
     test_bot.turn("L")
     self.assertEqual(test_bot.direction, "N")
Пример #5
0
 def test_14_output(self):
     test_bot = RobotController(
         fix_input_grid("5 5"),
         fix_input_start_pos("0 0 E"),
         fix_input_moves("RFLFFLRF"),
     )
     test_bot.move()
     test_bot.position()
     self.assertEqual(test_bot.current_position, "3 1 E")
Пример #6
0
 def test_3_test_robot_init(self):
     test_bot = RobotController(
         fix_input_grid("5 5"),
         fix_input_start_pos("0 0 E"),
         fix_input_moves("RFLFFLRF"),
     )
     self.assertEqual(test_bot.current_row, 0)
     self.assertEqual(test_bot.current_column, 0)
     self.assertEqual(test_bot.direction, "E")
     self.assertEqual(test_bot.commands[-1], "F")
Пример #7
0
 def test_2_test_input_moves(self):
     test_moves = fix_input_moves("RFLFFLRF")
     self.assertEqual(test_moves, ["R", "F", "L", "F", "F", "L", "R", "F"])