def test_partition_max_elt_pivot(self):
     array = [9, 12, 3, 1, 6, 8, 2, 5, 14, 13, 11, 7, 10, 4, 0]
     pivot = 14
     pivot_idx = array.index(pivot)
     init_len = len(array)
     Quicksort.partition_array(array, pivot_idx, 0, init_len)
     self.check_partition_valid(array, init_len, pivot, 0, init_len)
 def test_partition_partial_subset_right(self):
     array = [9, 12, 3, 1, 6, 8, 2, 5, 14, 13, 11, 7, 10, 4, 0]
     pivot = 6
     pivot_idx = array.index(pivot)
     init_len = len(array)
     Quicksort.partition_array(array, pivot_idx, 2, init_len)
     self.check_partition_valid(array, init_len, pivot, 2, init_len)
 def test_partition_with_dups(self):
     array = [9, 12, 3, 2, 1, 6, 8, 2, 6]
     pivot = 6
     pivot_idx = array.index(pivot)
     init_len = len(array)
     Quicksort.partition_array(array, pivot_idx, 0, init_len)
     self.check_partition_valid(array, init_len, pivot, 0, init_len)
 def test_partition_full(self):
     array = [9, 12, 3, 1, 6, 8, 2, 5, 14, 13, 11, 7, 10, 4, 0]
     pivot = 8
     pivot_idx = array.index(pivot)
     init_len = len(array)
     Quicksort.partition_array(array, pivot_idx, 0, init_len)
     self.check_partition_valid(array, init_len, pivot, 0, init_len)
     self.assertEqual(pivot, array[pivot])