Example #1
0
        public void Test_Empty_WhenCleaning()
        {
            MaxPQ <Int32> pq = new MaxPQ <Int32>(1);

            pq.Add(2);
            pq.DeleteMax();

            Assert.True(pq.IsEmpty);
            Assert.Equal(0, pq.Count);
        }
Example #2
0
        public void Test_Add_DeleteMax_Order()
        {
            MaxPQ <Int32> pq = new MaxPQ <Int32>(10);

            for (int i = 1; i < 11; i++)
            {
                pq.Add(i);
            }

            for (int i = 10; i > 0; i--)
            {
                Assert.Equal(pq.DeleteMax(), i);
            }
        }