public void PriorotyQueue_CountIsCorrectAfterSingleRemove() { MaxHeapPriorityQueue pq = new MaxHeapPriorityQueue(); pq.Enqueue(10, 1); pq.Dequeue(); Assert.AreEqual(0, pq.Count); }
public void PriorotyQueue_DequeueSingleNodePQ() { MaxHeapPriorityQueue pq = new MaxHeapPriorityQueue(); for (int i = 0; i < 5; i++) { pq.Enqueue(i * 10, i); } PQNode dequeueNode = pq.Dequeue(); Assert.AreEqual(40, dequeueNode.Priority); }
public void PriorotyQueue_MethodsExist() { MaxHeapPriorityQueue pq = new MaxHeapPriorityQueue(); pq.Enqueue(10, 1); pq.Dequeue(); pq.Peek(); pq.ToSortedArray(); pq.ToString(); int num = pq.Count; Assert.IsNotNull(pq); }
public void PriorotyQueue_DequeueFullTreeToEmpty() { MaxHeapPriorityQueue pq = new MaxHeapPriorityQueue(); for (int i = 0; i < 13; i++) { pq.Enqueue(i * 10, i); } for (int i = 0; i < 16; i++) { pq.Dequeue(); } Assert.AreEqual(0, pq.Count); Assert.AreEqual("", pq.ToString()); }
public void DequeueFullTreeToEmpty() { MaxHeapPriorityQueue pq = CreateThirteenNodePQDescending(); for (int i = 0; i < 13; i++) { pq.Dequeue(); } int expectedCount = 0; int actualCount = pq.Count; string expectedString = ""; string actualString = pq.ToString(); Assert.AreEqual(expectedCount, actualCount); Assert.AreEqual(expectedString, actualString); }