Exemplo n.º 1
0
def test_multi(check_itr=1000):
    for _ in range(check_itr):
        a = []
        no_dup = randint(2, 100)
        for i in range(no_dup):  # no dup array length
            repeat = randint(1, 3)
            a += [i] * repeat
        new_head = deleteDuplicates(mklist(*a))
        assert convert_array(new_head) == list(range(no_dup))
Exemplo n.º 2
0
def test_multi(check_itr=1000):
    for _ in range(check_itr):
        in_a = []
        expect_a = []
        last_num = randint(2, 100)
        for i in range(last_num):  # no dup array length
            repeat = randint(1, 3)
            if repeat == 1:
                expect_a += [i]
            in_a += [i] * repeat
        new_head = deleteDuplicates(mklist(*in_a))
        assert convert_array(new_head) == expect_a
Exemplo n.º 3
0
def test_ones():
    assert [42] == convert_array(deleteDuplicates(mklist(42, 42, 42)))
Exemplo n.º 4
0
def test_one():
    assert [42] == convert_array(deleteDuplicates(ListNode(42)))
Exemplo n.º 5
0
def test_none():
    assert deleteDuplicates(None) is None