Exemplo n.º 1
0
def test_solution():
    import solution

    vects1 = [((1, 3), (2, 6)), ((1, 5), (3, 4)), ((2, 6), (2, 9))]
    ret1 = [((1, 5), (3, 4)), ((2, 6), (2, 9)), ((1, 3), (2, 6))]

    vects2 = [((2, 6), (2, 9)), ((1, 3), (2, 6))]  #sorted order

    vects3 = [((1, 8), (2, 4))]

    assert solution.sort_vectors(vects1) == ret1
    assert solution.sort_vectors([]) == []
    assert solution.sort_vectors(vects2) == vects2
    assert solution.sort_vectors(vects3) == vects3
Exemplo n.º 2
0
def test_solution():
    import solution
    vec1 = solution.Vector3D(1, 5, 3)
    vec2 = solution.Vector3D(4, 4, 1)
    vec3 = solution.Vector3D(1, 5, 2)
    vec4 = solution.Vector3D(4, 4, 1)
    vect_lst = [vec1, vec2, vec3, vec4]
    sorted_lst = [vec3, vec2, vec4, vec1]
    ret_lst = solution.sort_vectors(vect_lst)

    for x, y in zip(ret_lst, sorted_lst):
        assert str(x) == str(y)
Exemplo n.º 3
0
def test_solution():
    from solution import Vector3D, sort_vectors

    vec1 = Vector3D(1, 5, 3)
    vec2 = Vector3D(4, 4, 1)
    vec3 = Vector3D(1, 5, 2)
    vec4 = Vector3D(4, 4, 1)
    vect_lst = [vec1, vec2, vec3, vec4]
    sorted_lst = [vec3, vec2, vec4, vec1]
    ret_lst = sort_vectors(vect_lst)

    for r, s in zip(ret_lst, sorted_lst):
        assert str(r) == str(s)
Exemplo n.º 4
0
def test_solution():
    assert solution.sort_vectors(vects1) == ret1
    assert solution.sort_vectors([]) == []
    assert solution.sort_vectors(vects2) == vects2
    assert solution.sort_vectors(vects3) == vects3