예제 #1
0
 def test_size(self):
     lst = UnrolledLinkedList(Node())
     self.assertEqual(lst.size(), 0)
     lst.insert(0, 1)
     self.assertEqual(lst.size(), 1)
     lst.insert(lst.total_size, 2)
     self.assertEqual(lst.size(), 2)
예제 #2
0
 def test_to_list(self):
     self.assertEqual(UnrolledLinkedList(Node()).to_list(), [])
     lst = UnrolledLinkedList(Node())
     lst.insert(0, 'a')
     self.assertEqual(lst.to_list(), ['a'])
     lst.insert(1, 2)
     self.assertEqual(lst.to_list(), ['a', 2])
예제 #3
0
 def test_find(self):
     x = [
         1,
         2,
         3,
     ]
     lst = UnrolledLinkedList(Node())
     lst.insert(0, 1)
     lst.insert(1, 2)
     index = lst.find(1)
     self.assertEqual(0, index)