コード例 #1
0
    def test_facing_west_decrements_x(self):
        robot = Robot(WEST, 0, 0)
        robot.move("A")

        self.assertEqual(robot.coordinates, (-1, 0))
        self.assertEqual(robot.direction, WEST)
コード例 #2
0
    def test_facing_south_decrements_y(self):
        robot = Robot(SOUTH, 0, 0)
        robot.move("A")

        self.assertEqual(robot.coordinates, (0, -1))
        self.assertEqual(robot.direction, SOUTH)
コード例 #3
0
    def test_facing_east_increments_x(self):
        robot = Robot(EAST, 0, 0)
        robot.move("A")

        self.assertEqual(robot.coordinates, (1, 0))
        self.assertEqual(robot.direction, EAST)
コード例 #4
0
    def test_changes_south_to_east(self):
        robot = Robot(SOUTH, 0, 0)
        robot.move("L")

        self.assertEqual(robot.coordinates, (0, 0))
        self.assertEqual(robot.direction, EAST)
コード例 #5
0
    def test_moving_west_and_north(self):
        robot = Robot(NORTH, 0, 0)
        robot.move("LAAARALA")

        assert robot.coordinates == (-4, 1)
        assert robot.direction == WEST
コード例 #6
0
    def test_moving_west_and_south(self):
        robot = Robot(EAST, 2, -7)
        robot.move("RRAAAAALA")

        self.assertEqual(robot.coordinates, (-3, -8))
        self.assertEqual(robot.direction, SOUTH)
コード例 #7
0
    def test_changes_north_to_west(self):
        robot = Robot(NORTH, 0, 0)
        robot.move("L")

        self.assertEqual(robot.coordinates, (0, 0))
        self.assertEqual(robot.direction, WEST)
コード例 #8
0
    def test_changes_east_to_north(self):
        robot = Robot(EAST, 0, 0)
        robot.move("L")

        assert robot.coordinates == (0, 0)
        assert robot.direction == NORTH
コード例 #9
0
    def test_facing_north_increments_y(self):
        robot = Robot(NORTH, 0, 0)
        robot.move("A")

        assert robot.coordinates == (0, 1)
        assert robot.direction == NORTH
コード例 #10
0
    def test_changes_west_to_south(self):
        robot = Robot(WEST, 0, 0)
        robot.move("L")

        assert robot.coordinates == (0, 0)
        assert robot.direction == SOUTH
コード例 #11
0
    def test_changes_south_to_east(self):
        robot = Robot(SOUTH, 0, 0)
        robot.move("L")

        assert robot.coordinates == (0, 0)
        assert robot.direction == EAST
コード例 #12
0
    def test_changes_north_to_west(self):
        robot = Robot(NORTH, 0, 0)
        robot.move("L")

        assert robot.coordinates == (0, 0)
        assert robot.direction == WEST
コード例 #13
0
    def test_moving_east_and_north(self):
        robot = Robot(SOUTH, 8, 4)
        robot.move("LAAARRRALLLL")

        assert robot.coordinates == (11, 5)
        assert robot.direction == NORTH
コード例 #14
0
    def test_moving_west_and_south(self):
        robot = Robot(EAST, 2, -7)
        robot.move("RRAAAAALA")

        assert robot.coordinates == (-3, -8)
        assert robot.direction == SOUTH
コード例 #15
0
    def test_moving_east_and_north_from_readme(self):
        robot = Robot(NORTH, 7, 3)
        robot.move("RAALAL")

        self.assertEqual(robot.coordinates, (9, 4))
        self.assertEqual(robot.direction, WEST)
コード例 #16
0
    def test_facing_south_decrements_y(self):
        robot = Robot(SOUTH, 0, 0)
        robot.move("A")

        assert robot.coordinates == (0, -1)
        assert robot.direction == SOUTH
コード例 #17
0
    def test_moving_west_and_north(self):
        robot = Robot(NORTH, 0, 0)
        robot.move("LAAARALA")

        self.assertEqual(robot.coordinates, (-4, 1))
        self.assertEqual(robot.direction, WEST)
コード例 #18
0
    def test_facing_east_increments_x(self):
        robot = Robot(EAST, 0, 0)
        robot.move("A")

        assert robot.coordinates == (1, 0)
        assert robot.direction == EAST
コード例 #19
0
    def test_moving_east_and_north(self):
        robot = Robot(SOUTH, 8, 4)
        robot.move("LAAARRRALLLL")

        self.assertEqual(robot.coordinates, (11, 5))
        self.assertEqual(robot.direction, NORTH)
コード例 #20
0
    def test_facing_west_decrements_x(self):
        robot = Robot(WEST, 0, 0)
        robot.move("A")

        assert robot.coordinates == (-1, 0)
        assert robot.direction == WEST
コード例 #21
0
    def test_changes_west_to_south(self):
        robot = Robot(WEST, 0, 0)
        robot.move("L")

        self.assertEqual(robot.coordinates, (0, 0))
        self.assertEqual(robot.direction, SOUTH)
コード例 #22
0
    def test_facing_north_increments_y(self):
        robot = Robot(NORTH, 0, 0)
        robot.move("A")

        self.assertEqual(robot.coordinates, (0, 1))
        self.assertEqual(robot.direction, NORTH)
コード例 #23
0
    def test_changes_east_to_north(self):
        robot = Robot(EAST, 0, 0)
        robot.move("L")

        self.assertEqual(robot.coordinates, (0, 0))
        self.assertEqual(robot.direction, NORTH)
コード例 #24
0
    def test_moving_east_and_north_from_readme(self):
        robot = Robot(NORTH, 7, 3)
        robot.move("RAALAL")

        assert robot.coordinates == (9, 4)
        assert robot.direction == WEST