Exemplo n.º 1
0
        private static void PopElements <T>(PriorityQueue <T> pq)
        {
            int size = pq.Size();

            for (int i = 0; i < size; i++)
            {
                pq.Pop();
            }
        }
Exemplo n.º 2
0
        private static void PopAndTestElements <T>(PriorityQueue <T> pq, T[] elements)
        {
            int size = pq.Size();

            for (int i = 0; i < size; i++)
            {
                Assert.AreEqual(pq.Pop(), elements[i]);
            }
        }
Exemplo n.º 3
0
        private static void PopAndTestElements <T>(PriorityQueue <T> pq)
        {
            int size = pq.Size();
            T   last = pq.Pop();

            for (int i = 1; i < size; i++)
            {
                T next = pq.Pop();
                Assert.IsTrue(pq.LessThan(last, next));
                last = next;
            }
        }
Exemplo n.º 4
0
 private static void AddAndTest <T>(PriorityQueue <T> pq, T element, T expectedTop, int expectedSize)
 {
     pq.Add(element);
     Assert.AreEqual(pq.Top(), expectedTop);
     Assert.AreEqual(pq.Size(), expectedSize);
 }