public void Test_constructor1() { Queue = new MyPriorityQueue <int>(); Assert.True(Queue.IsEmpty()); Assert.Equal(10, Queue.HeapCapacity); }
public void Test_poll() { Queue = new MyPriorityQueue <int>(); foreach (var e in RandArr) { Queue.Add(e); } while (!Queue.IsEmpty()) { Queue.Poll(); } Assert.True(Queue.IsEmpty()); }
public void Test_constructor2() { Queue = new MyPriorityQueue <int>(RandArr); Assert.False(Queue.IsEmpty()); Assert.Equal(RandArr.Length, Queue.HeapCapacity); Assert.Equal(RandArr.Length, Queue.HeapSize); }
public void Test_remove() { Queue = new MyPriorityQueue <int>(RandArr); for (int i = 0; i < RandArr.Length; i++) { Assert.True(Queue.Remove(i)); } Assert.True(Queue.IsEmpty()); }
public void Test_add() { Queue = new MyPriorityQueue <int>(); for (int i = RandArr.Length - 1; i >= 0; i--) { Queue.Add(RandArr[i]); } for (int i = 0; i < RandArr.Length; i++) { Queue.Add(RandArr[i]); } Assert.True(Queue.IsMinHeap(0)); Assert.False(Queue.IsEmpty()); Assert.Equal(2 * RandArr.Length, Queue.HeapSize); }
public void Test_empty_constructor() { Queue = new MyPriorityQueue <int>(); Assert.True(Queue.IsEmpty()); }