public void CanRemoveSpecificNode() { var pQueue = new PQueue(); var node1 = pQueue.Insert("A:11"); var node2 = pQueue.Insert("A:12"); var node3 = pQueue.Insert("A:13"); pQueue.Remove(node2); var extractedNodeA = pQueue.Extract(); Assert.AreEqual(node1, extractedNodeA); var extractedNodeB = pQueue.Extract(); Assert.AreEqual(node3, extractedNodeB); Assert.IsTrue(pQueue.IsEmpty()); }
static void TestFunc(PriorityQueue.PQueue <TestThing> pq) { while (pq.Count > 5) { Console.Write(pq.Pop() + ", "); } Console.WriteLine(pq.Pop()); pq.Push(new TestThing("", 8)); pq.Push(new TestThing("", 2)); pq.Remove(new TestThing("a", 7)); pq.Push(new TestThing("", 6)); pq.Push(new TestThing("", 4)); while (pq.Count > 1) { Console.Write(pq.Pop() + ", "); } Console.WriteLine(pq.Pop()); Console.WriteLine(HR); }