def test_delete_1(self): linked_list = LinkedList() linked_list.add_in_tail(self.n1) linked_list.delete(12) self.assertEqual(linked_list.head, None) self.assertEqual(linked_list.tail, None)
def test_add_in_head_2(self): linked_list = LinkedList() linked_list.add_in_tail(self.n1) linked_list.add_in_head(self.n6) self.assertEqual(linked_list.head, self.n6) self.assertEqual(linked_list.tail, self.n1) self.assertEqual(self.n1.prev, self.n6) self.assertEqual(self.n6.next, self.n1)
def test_delete_3(self): linked_list = LinkedList() linked_list.add_in_tail(self.n1) linked_list.add_in_tail(self.n2) linked_list.delete(12) self.assertEqual(linked_list.head, self.n2) self.assertEqual(linked_list.tail, self.n2) self.assertEqual(linked_list.head.prev, None) self.assertEqual(linked_list.head.next, None)
def test_insert_2(self): linked_list = LinkedList() linked_list.add_in_tail(self.n1) linked_list.add_in_tail(self.n3) linked_list.insert(self.n3, self.n6) self.assertEqual(linked_list.head, self.n1) self.assertEqual(linked_list.tail, self.n6) self.assertEqual(self.n3.next, self.n6) self.assertEqual(self.n6.next, None) self.assertEqual(self.n6.prev, self.n3)
def test_find_all_2(self): linked_list = LinkedList() linked_list.add_in_tail(self.n1) linked_list.add_in_tail(self.n2) linked_list.add_in_tail(self.n3) linked_list.add_in_tail(self.n6) linked_list.add_in_tail(self.n7) self.assertEqual(linked_list.find_all(12), [self.n1, self.n2, self.n7])
def test_delete_all_3(self): linked_list = LinkedList() linked_list.add_in_tail(self.n1) linked_list.add_in_tail(self.n2) linked_list.add_in_tail(self.n7) linked_list.add_in_tail(self.n8) linked_list.delete(12, True) self.assertEqual(linked_list.head, None) self.assertEqual(linked_list.tail, None)
def test_delete_all_1(self): linked_list = LinkedList() linked_list.add_in_tail(self.n1) linked_list.add_in_tail(self.n2) linked_list.add_in_tail(self.n3) linked_list.delete(12, True) self.assertEqual(linked_list.head, self.n3) self.assertEqual(linked_list.tail, self.n3) self.assertEqual(linked_list.head.prev, None)
def test_find_2(self): linked_list = LinkedList() linked_list.add_in_tail(self.n3) linked_list.add_in_tail(self.n1) linked_list.add_in_tail(self.n2) self.assertEqual(linked_list.find(12), self.n1)
def test_delete_4(self): linked_list = LinkedList() linked_list.add_in_tail(self.n3) linked_list.add_in_tail(self.n1) linked_list.add_in_tail(self.n2) linked_list.add_in_tail(self.n6) linked_list.delete(12) self.assertEqual(linked_list.head, self.n3) self.assertEqual(linked_list.tail, self.n6) self.assertEqual(self.n3.next, self.n2) self.assertEqual(self.n2.prev, self.n3)
def test_find_4(self): linked_list = LinkedList() linked_list.add_in_tail(self.n3) self.assertEqual(linked_list.find_all(12), [])
def test_find_all(self): linked_list = LinkedList() self.assertEqual(linked_list.find_all(12), [])
def test_find_3(self): linked_list = LinkedList() linked_list.add_in_tail(self.n3) self.assertEqual(linked_list.find(12), None)
def test_add_in_head(self): linked_list = LinkedList() linked_list.add_in_head(self.n6) self.assertEqual(linked_list.head, self.n6) self.assertEqual(linked_list.tail, self.n6)
def test_insert_1(self): linked_list = LinkedList() linked_list.insert(None, self.n6) self.assertEqual(linked_list.head, self.n6) self.assertEqual(linked_list.tail, self.n6)
def test_delete_all_2(self): linked_list = LinkedList() linked_list.add_in_tail(self.n1) linked_list.add_in_tail(self.n2) linked_list.add_in_tail(self.n3) linked_list.add_in_tail(self.n4) linked_list.add_in_tail(self.n5) linked_list.add_in_tail(self.n6) linked_list.add_in_tail(self.n7) linked_list.add_in_tail(self.n8) linked_list.delete(12, True) self.assertEqual(linked_list.head, self.n3) self.assertEqual(linked_list.tail, self.n6) self.assertEqual(self.n6.prev, self.n3) self.assertEqual(self.n6.next, None) self.assertEqual(self.n3.prev, None) self.assertEqual(self.n3.next, self.n6)
def test_find(self): linked_list = LinkedList() self.assertEqual(linked_list.find(12), None)