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