Example #1
0
 public void PeakEmptyHeapReturnsNull()
 {
     using (NativeBinaryHeap <int> heap = CreateEmptyHeap())
     {
         Assert.That(heap.Peak(), Is.Null);
     }
 }
Example #2
0
        public void PushAndPopFunctionsCorrectly()
        {
            using (NativeBinaryHeap <int> heap = CreateEmptyHeap())
            {
                heap.Push(1);
                heap.Push(5);
                heap.Push(2);

                Assert.That(heap.Peak(), Is.EqualTo(5));
                Assert.That(heap.Length, Is.EqualTo(3));

                Assert.That(heap.Pop(), Is.EqualTo(5));
                Assert.That(heap.Pop(), Is.EqualTo(2));
                Assert.That(heap.Pop(), Is.EqualTo(1));
                Assert.That(heap.Pop(), Is.Null);
            }
        }