Ejemplo n.º 1
0
def test_same_values():
    values1 = [1, 2, 3, 4]
    values2 = [1, 2, 3, 4, 5]
    list1 = make_list(values1)
    list2 = make_list(values2)
    assert same_values(list1[0], values1)
    assert same_values(list2[0], values2)
    assert not same_values(list1[0], values2)
    assert not same_values(list2[0], values1)
def test_reverse_list():
    l = make_list([1, 2, 3, 4, 5])

    s = module.Solution()
    r = s.reverseList(l[0])

    assert same_values(r, [5, 4, 3, 2, 1])
def test_merge_two_lists_4():
    l = make_list([4, 5, 6])
    r = make_list([1, 2, 3])

    s = module.Solution()
    result = s.mergeTwoLists(l[0], r[0])

    assert same_values(result, [1, 2, 3, 4, 5, 6])
def test_merge_two_lists_3():
    l = make_list([2, 3, 4])
    r = make_list([5, 6, 7])

    s = module.Solution()
    result = s.mergeTwoLists(l[0], r[0])

    assert same_values(result, [2, 3, 4, 5, 6, 7])
Ejemplo n.º 5
0
def test_removeNthFromEnd1():
    s = module.Solution()
    l = make_list([1, 2, 3, 4, 5])
    r = s.removeNthFromEnd(l[0], 1)
    assert same_values(r, [1, 2, 3, 4])
Ejemplo n.º 6
0
def test_removeNthFromEnd3():
    s = module.Solution()
    l = make_list([1, 2, 3])
    r = s.removeNthFromEnd(l[0], 3)
    assert same_values(r, [2, 3])
Ejemplo n.º 7
0
def test_removeNthFromEnd1_v2():
    s = module.Solution()
    l = ListNode(1)
    r = s.removeNthFromEnd(l, 1)
    assert same_values(r, [])