示例#1
0
        public void Shrink_GivesCorrectNewSize()
        {
            var ms = new MaxStack <string>(10);

            ms.Shrink(0.5f);
            Assert.AreEqual(5, ms.MaxSize);
        }
示例#2
0
        public void Shrink_ExcessIsLost()
        {
            var ms = new MaxStack <int>(4);

            ms.Push(1);
            ms.Push(2);
            ms.Push(3);
            ms.Push(4);
            ms.Shrink(0.5f);
            Assert.AreEqual(2, ms.MaxSize);
            Assert.AreEqual(4, ms.Pop());
            Assert.AreEqual(3, ms.Pop());
            Assert.AreEqual(0, ms.Peek());
        }