def test_ll_merge_uneven_long_first(): ll1 = LinkedList() ll1.append(2) ll2 = LinkedList() ll2.append(1) ll2.append(3) ll2.append(5) mergedLists = LinkedList.merge_lls(ll2, ll1) assert str(mergedLists) == "{ 1 } -> { 2 } -> { 3 } -> { 5 } -> NULL" assert mergedLists.length == 4
def test_ll_merge_uneven_long_second(): ll1 = LinkedList() ll1.append(2) ll1.append(4) ll1.append(6) ll2 = LinkedList() ll2.append(1) mergedLists = LinkedList.merge_lls(ll2, ll1) assert str(mergedLists) == "{ 1 } -> { 2 } -> { 4 } -> { 6 } -> NULL" assert mergedLists.length == 4
def test_ll_merge1(): ll1 = LinkedList() ll1.append(2) ll1.append(4) ll1.append(6) ll2 = LinkedList() ll2.append(1) ll2.append(3) ll2.append(5) mergedLists = LinkedList.merge_lls(ll2, ll1) assert (str(mergedLists) == "{ 1 } -> { 2 } -> { 3 } -> { 4 } -> { 5 } -> { 6 } -> NULL") assert mergedLists.length == 6
def test_ll_merge_one_empty_list(): ll1 = LinkedList() ll1.append(0) ll2 = LinkedList() mergedLists = LinkedList.merge_lls(ll2, ll1) assert str(mergedLists) == "{ 0 } -> NULL"
def test_ll_merge_empty_lists(): ll1 = LinkedList() ll2 = LinkedList() mergedLists = LinkedList.merge_lls(ll2, ll1) assert str(mergedLists) == "NULL"