Esempio n. 1
0
        public void PeekPeekBottom01()
        {
            var capacity = 4;
            var cq       = new CircularStack <int>(capacity);

            for (int i = 0; i < 6; i++)
            {
                cq.Push(i);
            }
            Assert.AreEqual(capacity, cq.Count());
            Assert.AreEqual(5, cq.Peek());
            Assert.AreEqual(2, cq.PeekBottom());
        }
Esempio n. 2
0
        public void PushPop01()
        {
            var capacity = 4;
            var cq       = new CircularStack <int>(capacity);

            cq.Push(0);
            cq.Push(1);
            cq.Push(2);
            cq.Push(3);
            cq.Pop();
            cq.Pop();
            Assert.AreEqual(1, cq.Peek());
            Assert.AreEqual(0, cq.PeekBottom());
            cq.Push(4);
            cq.Push(5);
            Assert.AreEqual(5, cq.Peek());
            Assert.AreEqual(0, cq.PeekBottom());
            cq.Push(6);
            cq.Push(7);
            Assert.AreEqual(7, cq.Peek());
            Assert.AreEqual(4, cq.PeekBottom());
        }