public void IsEmpty01() { var hashq = new HashQueue <int>(); Assert.IsTrue(hashq.IsEmpty()); hashq.Enqueue(1); Assert.IsFalse(hashq.IsEmpty()); hashq.Dequeue(); Assert.IsTrue(hashq.IsEmpty()); Assert.Throws <EmptyException>(() => hashq.Dequeue()); }
public void Clear01() { var hashq = new HashQueue <int>(); hashq.Enqueue(1); hashq.Enqueue(2); Assert.IsFalse(hashq.IsEmpty()); hashq.Clear(); Assert.IsTrue(hashq.IsEmpty()); hashq.Enqueue(1); hashq.Enqueue(2); Assert.IsFalse(hashq.IsEmpty()); }
public void Delete_HeadTail_02() { var hashq = new HashQueue <int>(); Assert.AreEqual(0, hashq.Count()); hashq.Enqueue(1); Assert.AreEqual(1, hashq.Peek()); Assert.AreEqual(1, hashq.PeekTail()); hashq.Delete(1); Assert.IsTrue(hashq.IsEmpty()); }