Example #1
0
 def test_get_link_values(self):
     dll = DoubleLinkedList()
     dll.add(12)
     dll.add(99)
     dll.add(37)
     dll.add(66)
     items_expected = [12, 99, 37, 66]
     self.assertEqual(items_expected, dll.get_link_values())
     self.assertEqual(4, dll.count_links())
Example #2
0
 def test_delete_reconnect(self):
     dll = DoubleLinkedList()
     dll.add(12)
     dll.add(99)
     dll.add(37)
     dll.add(66)
     dll.add(44)
     dll.delete(37, reconnect=True)
     self.assertEqual([12, 99, 66, 44], dll.traverse())
     self.assertEqual([44, 66, 99, 12], dll.traverse_back())
     self.assertEqual([12, 99, 66, 44], dll.get_link_values())
     self.assertEqual(4, dll.count_links())