Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 def test_buildMaxHeap_trivialCase(self):
     arr = [0, 1]
     dac.build_maxHeap(arr)
     expected = [0, 1]
     self.assertEqual(expected, arr)