public void PriorityQueue_06_CheckForOverFlow() { // Arrange IPriorityQueue <int> q = DSBuilder.CreatePriorityQueueFull(); int current_size = q.Size(); // Act for (int i = 0; i < current_size * 100; i++) { q.Add(3); } // Assert // Just asserting we get to this line without an out-of-bounds exception // We _could_ check whether the new capacity is twice as big .. }
static void Opgave2() { PriorityQueue <int> pq = new PriorityQueue <int>(); // 4, 19, 3, 5, 12, 9, 2 pq.Add(4); pq.Add(19); pq.Add(3); pq.Add(5); pq.Add(12); pq.Add(9); pq.Add(2); System.Console.WriteLine(pq); pq.Remove(); System.Console.WriteLine(pq); //3 5 4 19 12 9 IPriorityQueue <int> q = DSBuilder.CreatePriorityQueueFull(); q.Add(5); }