Esempio n. 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]
Esempio n. 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]
Esempio n. 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]
Esempio n. 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]
Esempio n. 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]
Esempio n. 6
0
def test_insert_on_empty():
    d = DoubleLinkedList()
    d.insert(0, 1)
    assert (len(d)) == 1
    assert d[0] == 1
Esempio n. 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]
Esempio n. 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]
Esempio n. 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]
Esempio n. 10
0
def test_insert_on_empty():
    d = DoubleLinkedList()
    d.insert(0, 1)
    assert (len(d)) == 1
    assert d[0] == 1