int test_heap_arr_pop_min () { size_t arr_len = 10; size_t heap_size = 0; int *arr = init_heap(arr_len); heap_arr_insert(arr, 7, &heap_size, &arr_len); heap_arr_insert(arr, 7, &heap_size, &arr_len); heap_arr_insert(arr, 2, &heap_size, &arr_len); print_heap_arr(arr, arr_len); int popped = pop_min(arr, &heap_size); print_heap_arr(arr, arr_len); printf("popped: %d\n", popped); int expected[] = {7, 7}; int ret = 0; ret += arrs_equal(arr, expected, heap_size); free(arr); ret += popped == 2 ? 1 : 0; return ret; }
int main() { int arr[] = {-1, 27, 17, 3, 16, 13, 10, 1, 5, 7, 12, 4, 8, 9, 0}; heap_t heap; heap.arr = arr; heap.size = 15; heap.heap_size = 14; max_heapify(heap, 3); print_heap_arr(heap); }