public void BasicOperations1() { COFQ = new FixedCircularQueue <int>(4); COFQ.Enqueue(0); COFQ.Enqueue(1); COFQ.Enqueue(2); COFQ.Enqueue(3); Assert.AreEqual(0, COFQ.Dequeue()); Assert.AreEqual(1, COFQ.Dequeue()); Assert.AreEqual(2, COFQ.Dequeue()); Assert.AreEqual(3, COFQ.Dequeue()); }
public void mutlipleOverflow() { COFQ = new FixedCircularQueue <int>(2); COFQ.Enqueue(1); COFQ.Enqueue(2); COFQ.Enqueue(3);// All passed this should wrap around (pass) COFQ.Enqueue(4); COFQ.Enqueue(5); COFQ.Enqueue(6); COFQ.Enqueue(7); COFQ.Enqueue(8); COFQ.Enqueue(9); Assert.AreEqual(9, COFQ.Dequeue()); Assert.AreEqual(8, COFQ.Dequeue()); }
public void underflow() { COFQ = new FixedCircularQueue <int>(1); try { COFQ.Dequeue();// should fail Assert.Fail(); } catch (IndexOutOfRangeException) { // passed test } }