def test_insert(self): """ Test for Insert Function """ heap = MaxHeap(10) self.assertTrue(heap.is_empty()) self.assertFalse(heap.is_full()) for i in range(10): heap.insert(i) self.assertTrue(heap.is_full()) self.assertFalse(heap.is_empty())
def test_get(self): """ Test Get Functions """ heap = MaxHeap(10) for i in range(9): heap.insert(i) self.assertEqual(heap.get_heap_cap(), 10) self.assertEqual(heap.get_heap_size(), 9) self.assertFalse(heap.is_empty()) self.assertFalse(heap.is_full()) self.assertEqual(heap.heap_contents(), [8, 7, 5, 6, 2, 1, 4, 0, 3])