Ejemplo n.º 1
0
 def test_invalid_position_validation_y_out_of_bounds(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=5, y=99, direction=Direction.NORTH)
     self.assertFalse(plateau.isValidPosition(position))
     position = Position(x=5, y=-1, direction=Direction.NORTH)
     self.assertFalse(plateau.isValidPosition(position))
Ejemplo n.º 2
0
 def test_object_instantiation(self):
     plateau = Plateau(x=1, y=2)
     self.assertIsInstance(plateau, Plateau)
Ejemplo n.º 3
0
 def test_instantiation_from_invalid__with_wrong_argnumber(self):
     str_plt = '1'  # x, y, and direction
     plateau_from_string = Plateau.from_string(str_plt)
Ejemplo n.º 4
0
 def test_position_validation(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=5, y=5, direction=Direction.NORTH)
     self.assertTrue(plateau.isValidPosition(position))
Ejemplo n.º 5
0
 def test_instantiation_from_valid_string(self):
     plateau = Plateau(x=1, y=2)
     str_plt = '1 2'  # x, y, and direction
     plateau_from_string = Plateau.from_string(str_plt)
     self.assertEqual(plateau, plateau_from_string)
Ejemplo n.º 6
0
 def test_instantiation_from_invalid_string_with_wrong_y(self):
     str_plt = '1 someRandomInt'  # x, y, and direction
     plateau_from_string = Plateau.from_string(str_plt)
Ejemplo n.º 7
0
 def test_invalid_object_instantiation_invalid_y_char(self):
     plateau = Plateau(x=1, y='someRandomStuff')
Ejemplo n.º 8
0
 def test_invalid_object_instantiation_invalid_negative_y(self):
     plateau = Plateau(x=1, y=-2)
Ejemplo n.º 9
0
 def test_invalid_object_instantiation_invalid_negative_x(self):
     plateau = Plateau(x=-1, y=2)
Ejemplo n.º 10
0
 def test_object_instantiation(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=10, y=10, direction=Direction.NORTH)
     rover = Rover(plateau, position)
     self.assertIsInstance(rover, Rover)
Ejemplo n.º 11
0
 def test_invalid_movement_out_of_boundaries(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=10, y=10, direction=Direction.NORTH)
     rover = Rover(plateau, position)
     rover.move_forward()
Ejemplo n.º 12
0
 def test_rotation_right(self):
     plateau = Plateau(x=10, y=10)
     position = Position(x=10, y=10, direction=Direction.NORTH)
     rover = Rover(plateau, position)
     rover.rotate_right()
     self.assertEqual(rover.position.direction, Direction.EAST)
Ejemplo n.º 13
0
 def test_invalid_object_instantiation_wrong_position_object(self):
     lateau = Plateau(x=10, y=10)
     position = (5, 5, 'n')
     rover = Rover(plateau, position)