def test_reverse_when_linkedlist_is_empty(self): # Arrange linkedlist = LinkedList() # Act linkedlist.reverse() # Assert self.assertFalse(linkedlist.head)
def test_reverse_when_single_item_linkedlist(self): # Arrange linkedlist = LinkedList() linkedlist.push_back("Umair") # Act linkedlist.reverse() # Assert self.assertTrue(linkedlist.head and linkedlist.head.data == "Umair")
def test_reverse_when_more_than_two_items_linkedlist(self): # Arrange linkedlist = LinkedList() linkedlist.push_back("Umair") linkedlist.push_back("Aamir") linkedlist.push_back("Usman") # Act linkedlist.reverse() # Assert self.assertTrue(linkedlist.head and linkedlist.head.data == "Usman")