Example #1
0
def test_head_ll():

    anime = LinkedList()
    anime.insert("test head")
    expected = anime.head.data
    actual = 'test head'
    assert expected == actual
Example #2
0
def test_insert_multiple_nodes():
    anime = LinkedList()
    anime.insert("Abu")
    anime.insert("Rawan")
    expected = anime.__str__()
    actual = '(Rawan) -> (Abu) -> NULL'
    assert expected == actual
Example #3
0
def test_insert_ll():
    """
    Can properly insert into the linked list ?
    """
    anime = LinkedList()
    anime.insert("Slam Dunk")
    expected = anime.head.data
    actual = 'Slam Dunk'
    assert expected == actual
def linked():
    item = LinkedList()
    item.insert('Rawan')
    item.insert('12')
    item.insert('so')
    item.insert('cool')
    item.insert('yes')

    return item
Example #5
0
        temp = first
        first = second
        second = temp
        current_fll = first.head
        current_sll = second.head
    linked_first = first.head
    linked_second = second.head
    while linked_first and linked_second:
        first_next = linked_first.next_node
        second_next = linked_second.next_node
        linked_second.next_node = first_next
        linked_first.next_node = linked_second
        linked_first = first_next
        linked_second = second_next
        second.head = linked_second
    return first


myList = LinkedList()
myList.insert(5)
myList.insert(8)
myList.insert(12)
myList.append(3)

list = LinkedList()
myList.insert(1)
myList.insert(5)
myList.insert(88)
myList.append(4)

print(zipLists(myList, list))
def test_find_value_exists():
    myList = LinkedList()
    myList.insert('great')
    actual = myList.includes('great')
    expected = True
    assert actual == expected
def test_insert_multiple_nodes():
    expected = ['so', 'cool', 'yes']
    myList = LinkedList()
    actual = [myList.insert('so'), myList.insert('cool'), myList.insert('yes')]
    assert actual == expected