BLI_heap: add an API function to directly read the top node value.

It is very commonly needed in loop conditions to check if
the items in the heap are good enough to continue.
This commit is contained in:
Alexander Gavrilov
2018-11-04 13:27:10 +03:00
parent 0d69a5aa34
commit d3c815bd08
6 changed files with 18 additions and 5 deletions

View File

@@ -176,6 +176,7 @@ static void random_heap_reinsert_helper(
for (int out_test = 0; out_test < items_total; out_test++) {
HeapNode *node_top = BLI_heap_top(heap);
float out = BLI_heap_node_value(node_top);
EXPECT_EQ(out, BLI_heap_top_value(heap));
EXPECT_EQ((float)out_test, out);
BLI_heap_pop_min(heap);
}