示例#1
0
        /// <summary>
        ///GetLength 的测试
        ///</summary>
        public void GetLengthTestHelper <T>()
        {
            LinkStack <T> target   = new LinkStack <T>(); // TODO: 初始化为适当的值
            int           expected = 0;                   // TODO: 初始化为适当的值
            int           actual;

            actual = target.GetLength();
            Assert.AreEqual(expected, actual);

            target.Push(default(T));
            target.Push(default(T));

            Assert.AreEqual <int>(2, target.GetLength());
        }
示例#2
0
    void Start()
    {
        LinkStack <int> seqStack = new LinkStack <int>();

        for (int i = 0; i < 3; i++)
        {
            seqStack.Push(i);
        }
        print("展示栈顶元素:" + seqStack.Peek());
        print("栈数量:" + seqStack.GetLength());
        for (int i = 0; i < 3; i++)
        {
            print(seqStack.Pop());
        }
    }