def test_maxHeapExtractMax_returnsMaxValidHeapRemains(self): values = self.get_values(400) values[0] = 0 maxvalue = max(values) dac.build_maxHeap(values) maxActual = dac.maxHeapExtractMax(values) self.assertEqual(maxvalue, maxActual)
def test_buildMaxHeap_threeElement(self): arr = [0, 3, 2, 5, 6] dac.build_maxHeap(arr) expected = [0, 6, 3, 5, 2] self.assertEqual(expected, arr)
def test_buildMaxHeap_trivialCase(self): arr = [0, 1] dac.build_maxHeap(arr) expected = [0, 1] self.assertEqual(expected, arr)