Пример #1
0
        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());
        }
Пример #2
0
        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());
        }
Пример #3
0
        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());
        }