Exemple #1
0
def test_insert_on_position_0():
    d = DoubleLinkedList([1])
    d.insert(0, 0)
    print("\n", d, "\n")
    assert (len(d)) == 2
    assert d[0] == 0
    assert list(d) == [0, 1]
Exemple #2
0
def test_insert_on_position_0():
    d = DoubleLinkedList([1])
    d.insert(0, 0)
    print("\n", d, "\n")
    assert (len(d)) == 2
    assert d[0] == 0
    assert list(d) == [0, 1]
Exemple #3
0
def test_insert_on_position_minus_1():
    d = DoubleLinkedList([1, 2, 4])
    d.insert(-1, 3)
    assert (len(d)) == 4
    assert d[2] == 3
    assert list(d) == [1, 2, 3, 4]
Exemple #4
0
def test_insert_on_position_1():
    d = DoubleLinkedList([1, 3, 4])
    d.insert(1, 2)
    assert (len(d)) == 4
    assert d[1] == 2
    assert list(d) == [1, 2, 3, 4]
Exemple #5
0
def test_insert_on_position_0_larger():
    d = DoubleLinkedList([1, 2])
    d.insert(0, 0)
    assert (len(d)) == 3
    assert d[0] == 0
    assert list(d) == [0, 1, 2]
Exemple #6
0
def test_insert_on_empty():
    d = DoubleLinkedList()
    d.insert(0, 1)
    assert (len(d)) == 1
    assert d[0] == 1
Exemple #7
0
def test_insert_on_position_minus_1():
    d = DoubleLinkedList([1, 2, 4])
    d.insert(-1, 3)
    assert (len(d)) == 4
    assert d[2] == 3
    assert list(d) == [1, 2, 3, 4]
Exemple #8
0
def test_insert_on_position_1():
    d = DoubleLinkedList([1, 3, 4])
    d.insert(1, 2)
    assert (len(d)) == 4
    assert d[1] == 2
    assert list(d) == [1, 2, 3, 4]
Exemple #9
0
def test_insert_on_position_0_larger():
    d = DoubleLinkedList([1, 2])
    d.insert(0, 0)
    assert (len(d)) == 3
    assert d[0] == 0
    assert list(d) == [0, 1, 2]
Exemple #10
0
def test_insert_on_empty():
    d = DoubleLinkedList()
    d.insert(0, 1)
    assert (len(d)) == 1
    assert d[0] == 1