当前位置: 首页>>代码示例>>C#>>正文


C# LinkedStack.Pop方法代码示例

本文整理汇总了C#中LinkedStack.Pop方法的典型用法代码示例。如果您正苦于以下问题:C# LinkedStack.Pop方法的具体用法?C# LinkedStack.Pop怎么用?C# LinkedStack.Pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinkedStack的用法示例。


在下文中一共展示了LinkedStack.Pop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateStack_PushSomeElements_ShouldWorkCorrectly

        public void CreateStack_PushSomeElements_ShouldWorkCorrectly()
        {
            var stack = new LinkedStack<int>();
            stack.Push(2);
            stack.Push(6);

            Assert.AreEqual(2, stack.Count);
            Assert.AreEqual(6, stack.Pop());
            Assert.AreEqual(2, stack.Pop());
        }
开发者ID:nok32,项目名称:SoftUni,代码行数:10,代码来源:LinkedStackTests.cs

示例2: TestCountAfterPoping

 public void TestCountAfterPoping()
 {
     var stack = new LinkedStack<int>();
     stack.Push(1);
     stack.Push(2);
     stack.Push(3);
     stack.Pop();
     stack.Pop();
     Assert.AreEqual(1, stack.Count);
 }
开发者ID:bobosam,项目名称:DataStructures,代码行数:10,代码来源:LinkedStackTests.cs

示例3: Pop_Push

 public void Pop_Push()
 {
     LinkedStack<int> testPop = new LinkedStack<int>();
     Assert.AreEqual(0, testPop.Count);
     testPop.Push(3);
     Assert.AreEqual(1, testPop.Count);
     testPop.Push(3);
     Assert.AreEqual(2, testPop.Count);
     Assert.AreEqual(3, testPop.Pop());
     Assert.AreEqual(1, testPop.Count);
     Assert.AreEqual(3, testPop.Pop());
     Assert.AreEqual(0, testPop.Count);
 }
开发者ID:kosio197,项目名称:SoftUni_DataStructures,代码行数:13,代码来源:TestLincedStack.cs

示例4: Push_Pop_Elements

 public void Push_Pop_Elements()
 {
     var nums = new LinkedStack<int>();
     Assert.AreEqual(0, nums.Count);
     nums.Push(15);
     Assert.AreEqual(1, nums.Count);
     nums.Push(12);
     Assert.AreEqual(2, nums.Count);
     Assert.AreEqual(12, nums.Pop());
     Assert.AreEqual(1, nums.Count);
     Assert.AreEqual(15, nums.Pop());
     Assert.AreEqual(0, nums.Count);
 }
开发者ID:Petar-Ivanov256,项目名称:DataStuctures_HomeWorks,代码行数:13,代码来源:LinkedStackTests.cs

示例5: Test02StackPeek

        public void Test02StackPeek()
        {
            var s = new LinkedStack<int>();
            s.Push(3);
            s.Push(1);
            s.Push(8);
            s.Push(5);

            Assert.AreEqual(5, s.Peek());
            s.Pop();
            Assert.AreEqual(8, s.Peek());
            s.Pop();
            Assert.AreEqual(1, s.Peek());
        }
开发者ID:tongko,项目名称:LargeFileEditor,代码行数:14,代码来源:LinkedStackTests.cs

示例6: TestPushPop_ShouldReturnCorrectResultsAndUpdateCounterProperly

 public void TestPushPop_ShouldReturnCorrectResultsAndUpdateCounterProperly()
 {
     var stack = new LinkedStack<string>();
     Assert.IsTrue(stack.Count == 0);
     stack.Push("wow");
     Assert.IsTrue(stack.Count == 1);
     stack.Push("yeah");
     Assert.IsTrue(stack.Count == 2);
     var element = stack.Pop();
     Assert.AreEqual("yeah", element);
     Assert.IsTrue(stack.Count == 1);
     element = stack.Pop();
     Assert.AreEqual("wow", element);
     Assert.IsTrue(stack.Count == 0);
 }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:15,代码来源:UnitTest1.cs

示例7: Push_Pop_Two

        public void Push_Pop_Two()
        {
            var ints = new LinkedStack<int> ();
            Assert.AreEqual (0, ints.Count);

            int element1 = 1;
            ints.Push (element1);
            Assert.AreEqual (1, ints.Count);

            int element2 = 2;
            ints.Push (element2);
            Assert.AreEqual (2, ints.Count);

            {
                int poppedEl = ints.Pop ();
                Assert.AreEqual (poppedEl, element2);
                Assert.AreEqual (1, ints.Count);
            }

            {
                int poppedEl = ints.Pop ();
                Assert.AreEqual (poppedEl, element1);
                Assert.AreEqual (0, ints.Count);
            }
        }
开发者ID:psha-,项目名称:softuni-datastruct,代码行数:25,代码来源:UnitTestsLinkedStacks.cs

示例8: Test01StackPushPop

        public void Test01StackPushPop()
        {
            var s = new LinkedStack<int>();
            s.Push(3);
            s.Push(1);
            s.Push(8);
            s.Push(5);

            Assert.AreEqual(4, s.Count);
            Assert.AreEqual(5, s.Pop());
            Assert.AreEqual(8, s.Pop());
            Assert.AreEqual(1, s.Pop());
            Assert.AreEqual(3, s.Pop());
            Assert.AreEqual(0, s.Count);
            Assert.AreEqual(0, s.Pop());
        }
开发者ID:tongko,项目名称:LargeFileEditor,代码行数:16,代码来源:LinkedStackTests.cs

示例9: Test_Push_Pop

        public void Test_Push_Pop()
        {
            LinkedStack<int> roo = new LinkedStack<int>();
            Assert.AreEqual(0, roo.Count);
            roo.Push(9);
            Assert.AreEqual(1, roo.Count);
            Assert.AreEqual(9, roo.Pop());
            Assert.AreEqual(0, roo.Count);

            LinkedStack<string> testPush = new LinkedStack<string>();
            Assert.AreEqual(0, testPush.Count);
            for (int i = 1; i <= 1000; i++)
            {
                testPush.Push("as" + i);
                Assert.AreEqual(i, testPush.Count);

            }

            for (int i = 1000; i >= 1; i--)
            {
                Assert.AreEqual("as" + i, testPush.Pop());
                Assert.AreEqual(i - 1, testPush.Count);

            }
        }
开发者ID:kosio197,项目名称:SoftUni_DataStructures,代码行数:25,代码来源:TestLincedStack.cs

示例10: PopTest

 [TestMethod] // получение последнего элемента
 public void PopTest()
 {
     LinkedStack<object> data = new LinkedStack<object>();
     data.Push(8);
     data.Push(6);
     data.Pop();
 }
开发者ID:steeparts,项目名称:Muftiyev_Arthur_06,代码行数:8,代码来源:LinkedStack.cs

示例11: CheckCountAfterOnePop_ShouldBeZero

        public void CheckCountAfterOnePop_ShouldBeZero()
        {
            var linkedStack = new LinkedStack<int>();
            linkedStack.Push(1);
            linkedStack.Pop();

            Assert.AreEqual(0, linkedStack.Count);
        }
开发者ID:zerefel,项目名称:Data-Structures-And-Algorithms,代码行数:8,代码来源:LinkedStackPushPop.cs

示例12: CheckInitialCapacity_ShouldReturnCorrectElement

        public void CheckInitialCapacity_ShouldReturnCorrectElement()
        {
            var linkedStack = new LinkedStack<int>();

            linkedStack.Push(1);
            Assert.AreEqual(1, linkedStack.Count);

            linkedStack.Push(100);
            Assert.AreEqual(2, linkedStack.Count);

            linkedStack.Pop();
            Assert.AreEqual(1, linkedStack.Count);

            int element = linkedStack.Pop();
            Assert.AreEqual(1, element);
            Assert.AreEqual(0, linkedStack.Count);
        }
开发者ID:zerefel,项目名称:Data-Structures-And-Algorithms,代码行数:17,代码来源:LinkedStackPushPop.cs

示例13: Main

    static void Main()
    {
        LinkedStack<int> linkedStack = new LinkedStack<int>();

        linkedStack.Push(5);
        linkedStack.Push(7);
        linkedStack.Push(6);

        Console.WriteLine(linkedStack.Pop());
        Console.WriteLine(linkedStack.Pop());

        linkedStack.Push(1);
        linkedStack.Push(2);

        Console.WriteLine(linkedStack.Pop());
        Console.WriteLine(linkedStack.Pop());
    }
开发者ID:zerefel,项目名称:Data-Structures-And-Algorithms,代码行数:17,代码来源:LinkedStackMain.cs

示例14: Main

    static void Main(string[] args)
    {
        LinkedStack<int> stack = new LinkedStack<int>();
        stack.Push(1);
        stack.Push(2);
        stack.Push(3);
        stack.Push(4);
        stack.Push(5);
        stack.Push(6);
        stack.Push(7);
        Console.WriteLine(stack.Count == 7);
        Console.WriteLine();
        while (stack.Count > 0)
        {
            Console.WriteLine(stack.Pop());
        }

        stack.Push(1);
        stack.Push(2);
        stack.Push(3);
        stack.Push(4);
        stack.Push(5);
        stack.Push(6);
        stack.Push(7);
        stack.Push(8);
        stack.Push(9);
        stack.Push(10);
        stack.Push(11);
        stack.Push(12);
        stack.Push(13);
        stack.Push(14);
        stack.Push(15);
        stack.Push(16);
        stack.Push(17);
        stack.Push(18);
        stack.Push(19);
        stack.Push(20);
        stack.Push(21);

        Console.WriteLine(string.Join(", ", stack.ToArray()));
        Console.WriteLine(stack.Count == 21);
        while (stack.Count > 0)
        {
            Console.WriteLine(stack.Pop());
        }
    }
开发者ID:shnogeorgiev,项目名称:Software-University-Courses,代码行数:46,代码来源:LinkedStackExample.cs

示例15: PopElementFromStackShouldReturnTheProperElementAndDecreaseCountWithOne

 public void PopElementFromStackShouldReturnTheProperElementAndDecreaseCountWithOne()
 {
     LinkedStack<int> stackOfInts = new LinkedStack<int>();
     stackOfInts.Push(5);
     int poppedElement = stackOfInts.Pop();
     Assert.AreEqual(5, poppedElement);
     Assert.AreEqual(0, stackOfInts.Count);
 }
开发者ID:tockata,项目名称:Data-Structures,代码行数:8,代码来源:LinkedStackTests.cs


注:本文中的LinkedStack.Pop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。