def test_push_front_when_single_item_linked_list(self): # Arrange linkedlist = LinkedList() linkedlist.push_front("Umair") # Act pushed = linkedlist.push_front("Aamir") # Assert self.assertTrue(pushed) self.assertTrue(linkedlist.size() == 2) self.assertTrue(linkedlist.head.data == "Aamir")
def test_push_front_when_more_than_one_items_linked_list(self): # Arrange linkedlist = LinkedList() linkedlist.push_front("Umair") linkedlist.push_front("Aamir") # Act pushed = linkedlist.push_front("Rayan") # Assert self.assertTrue(pushed) self.assertTrue(linkedlist.size() == 3) self.assertTrue(linkedlist.head.data == "Rayan")
def test_push_front_when_empty_linked_list(self): # Arrange linkedlist = LinkedList() # Act pushed = linkedlist.push_front("Umair") # Assert self.assertTrue(pushed) self.assertTrue(linkedlist.size() == 1) self.assertTrue(linkedlist.find("Umair"))