예제 #1
0
        public void testClear()
        {
            UnpickleStack s = new UnpickleStack();

            s.add("x");
            s.add("y");
            Assert.AreEqual(2, s.size());
            s.clear();
            Assert.AreEqual(0, s.size());
        }
예제 #2
0
        public void testTrim()
        {
            UnpickleStack s = new UnpickleStack();

            s.add("a");
            s.add("b");
            s.add("c");
            s.add("d");
            s.add("e");
            Assert.AreEqual(5, s.size());
            s.trim();
            Assert.AreEqual(5, s.size());
        }
예제 #3
0
        public void testAddPop()
        {
            UnpickleStack s = new UnpickleStack();

            Assert.AreEqual(0, s.size());
            s.add("x");
            Assert.AreEqual(1, s.size());
            s.add("y");
            Assert.AreEqual(2, s.size());
            Assert.AreEqual("y", s.peek());
            Assert.AreEqual("y", s.pop());
            Assert.AreEqual("x", s.peek());
            Assert.AreEqual("x", s.pop());
            Assert.AreEqual(0, s.size());
        }