Exemplo n.º 1
0
 def testRemove(self):
     linkedList = DblLinkedList()
     linkedList.addLast(2)
     linkedList.addLast(3)
     linkedList.addLast(5)
     self.assertEqual(5, linkedList.remove(5))
     self.assertEqual(2, linkedList.getSize())
Exemplo n.º 2
0
 def testRemoveAtIndex(self):
     linkedList = DblLinkedList()
     linkedList.addLast(2)
     linkedList.addLast(3)
     linkedList.addLast(5)
     self.assertEqual(3, linkedList.removeAtIndex(1))
     self.assertEqual(2, linkedList.getSize())
Exemplo n.º 3
0
 def testAdd(self):
     linkedList = DblLinkedList()
     linkedList.addLast(2)
     linkedList.addLast(3)
     linkedList.add(1, 5)
     self.assertEqual(3, linkedList.size)
     self.assertEqual(linkedList.getAtIndex(1), 5)
Exemplo n.º 4
0
 def testAddLast(self):
     linkedList = DblLinkedList()
     linkedList.addLast(2)
     linkedList.addLast(3)
     self.assertEqual(2, linkedList.size)
     self.assertEqual(linkedList.getFirst(), 2)
     self.assertEqual(linkedList.getLast(), 3)
Exemplo n.º 5
0
 def testContains(self):
     linkedList = DblLinkedList()
     self.assertFalse(linkedList.contains(2))
     linkedList.addLast(2)
     linkedList.addLast(3)
     linkedList.add(1, 5)
     self.assertFalse(linkedList.contains(1))
     self.assertTrue(linkedList.contains(2))
     self.assertTrue(linkedList.contains(3))
     self.assertTrue(linkedList.contains(5))
Exemplo n.º 6
0
 def testRemoveLast(self):
     linkedList = DblLinkedList()
     linkedList.addLast(2)
     linkedList.addLast(3)
     self.assertEqual(3, linkedList.removeLast())
     self.assertEqual(1, linkedList.getSize())
Exemplo n.º 7
0
 def testClear(self):
     linkedList = DblLinkedList()
     linkedList.addLast(2)
     self.assertFalse(linkedList.isEmpty())
     linkedList.clear()
     self.assertTrue(linkedList.isEmpty())