Beispiel #1
0
 def test_size(self):
     dll = Dll()
     size = dll.size_dll()
     # Test an empty Linked List
     assert size == 0
     # Test Linked List with some nodes
     dll.add_at_head(1)
     dll.add_at_head(2)
     dll.add_at_head(3)
     dll.add_at_head(4)
     size = dll.size_dll()
     assert size == 4
Beispiel #2
0
 def test_add_at_tail(self):
     dll = Dll()
     dll.add_at_head("apple")
     dll.add_at_head("orange")
     dll.add_at_tail("mango")
     assert str(dll.head) == "orange"
     assert dll.size_dll() == 3
Beispiel #3
0
 def test_add_at_nth_position(self):
     dll = Dll()
     dll.add_at_head(1)
     dll.add_at_head(2)
     dll.add_at_head(3)
     dll.add_at_head(4)
     dll.add_at_nth_position(5, 0)
     size = dll.size_dll()
     assert size == 5