Exemple #1
0
        public void Clear()
        {
            // Create a new heap.
            ConcurrentBinaryMinHeap <int> heap = new ConcurrentBinaryMinHeap <int>();

            // Push 3 elements onto the heap.
            heap.Push(1f, 2);
            heap.Push(3f, 6);
            heap.Push(2f, 4);

            // Ensure that 3 elements have been added to the heap.
            Assert.That(heap.Count, Is.EqualTo(3));

            // Clear the heap.
            heap.Clear();

            // Ensure that all of the elements have been removed.
            Assert.That(heap.Count, Is.EqualTo(0));
        }