Showing with 12 additions and 0 deletions.
  1. +12 −0 std/container/binaryheap.d
12 changes: 12 additions & 0 deletions std/container/binaryheap.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ import std.traits;

public import std.container.util;

///
unittest
{
import std.algorithm.comparison : equal;
import std.range : take;
auto maxHeap = heapify([4, 7, 3, 1, 5]);
assert(maxHeap.take(3).equal([7, 5, 4]));

auto minHeap = heapify!"a > b"([4, 7, 3, 1, 5]);
assert(minHeap.take(3).equal([1, 3, 4]));
}

// BinaryHeap
/**
Implements a $(WEB en.wikipedia.org/wiki/Binary_heap, binary heap)
Expand Down