Example #1
0
 def test_doublyLinkedlist_remove(self):
     #we remove both the head and the tail here to see that it works
     L = DoubleLinkedlist()
     L.insertFirst(6, 5, 30, 50)
     L.remove(6)
     L.remove(50)
     self.assertEqual(L.toList(), [30,5])
Example #2
0
 def test_doublyLinkedlist_search_forwards(self):
     L = DoubleLinkedlist()
     L.insertFirst(1, 2, 3, 4, 5)
     self.assertEqual(L.search_by_index(2).getData(), 2)
Example #3
0
 def test_doublyLinkedList_search_byValue(self):
     L = DoubleLinkedlist()
     L.insertFirst(6, 5, 30, 50)
     self.assertEqual(L.search(50).getData(), 50)
Example #4
0
 def test_doublyLinkedlist_insert_first(self):
     L = DoubleLinkedlist()
     L.insertFirst(5, 6, 30, 50, 60, 3)
     L.show()
     self.assertEqual(L.toList(), [3, 60, 50, 30, 6, 5] )