Ejemplo n.º 1
0
def test_find_intersections():
    path1 = convert_instructions_to_path("R8,U5,L5,D3".split(','))
    path2 = convert_instructions_to_path("U7,R6,D4,L4".split(','))
    assert find_intersections(path1, path2) == {(3, 3), (6, 5)}
Ejemplo n.º 2
0
def test_complicated_coords():
    assert list(convert_instructions_to_path(["U3", "R3", "D2", "L1"])) == [
        (0, 1), (0, 2), (0, 3), (1, 3), (2, 3), (3, 3), (3, 2), (3, 1), (2, 1)
    ]  # noqa: E501
Ejemplo n.º 3
0
def test_line_left_coords():
    assert list(convert_instructions_to_path(["L1"])) == [
        (-1, 0),
    ]
Ejemplo n.º 4
0
def test_line_right_coords():
    assert list(convert_instructions_to_path(["R3"])) == [(1, 0), (2, 0),
                                                          (3, 0)]
Ejemplo n.º 5
0
def test_line_down_coords():
    assert list(convert_instructions_to_path(["D2"])) == [(0, -1), (0, -2)]
Ejemplo n.º 6
0
def test_line_up_coords():
    assert list(convert_instructions_to_path(["U2"])) == [(0, 1), (0, 2)]