public void Execute()
 {
     for (var i = 0; i < 100000; i++)
     {
         p.Push(i);
     }
 }
예제 #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);
            }
        }