public void MinBinaryHeapClearTest() { MinBinaryHeap <int, int> heap = new MinBinaryHeap <int, int>(); Assert.AreEqual(0, heap.Size); heap.Clear(); Assert.AreEqual(0, heap.Size); heap.Insert(1, 11); heap.Insert(2, 22); Assert.AreEqual(2, heap.Size); heap.Clear(); Assert.AreEqual(0, heap.Size); }
public void MinBinaryHeapIsEmptyTest() { MinBinaryHeap <int, int> heap = new MinBinaryHeap <int, int>(); Assert.IsTrue(heap.IsEmpty); heap.Insert(1, 1); heap.Insert(2, 2); Assert.IsFalse(heap.IsEmpty); heap.Clear(); Assert.IsTrue(heap.IsEmpty); }
/// <summary>Empties the queue.</summary> public void Clear() { lock (_syncLock) _minHeap.Clear(); }