Exemplo n.º 1
0
        public static void StackWithMin_Test()
        {
            StackWithMin swm = new StackWithMin();

            swm.Push(2);
            swm.Push(1);
            swm.Push(3);
            swm.Push(4);
            int min = swm.Min();

            int[] poppedItem = new int[4];
            int   i          = 0;

            while (swm.Count() > 0)
            {
                poppedItem[i++] = swm.Pop();
            }
            Assert.AreEqual(new int[] { 4, 3, 1, 2 }, poppedItem);
            Assert.AreEqual(1, min);
        }
Exemplo n.º 2
0
 public static void StackWithMin_Test()
 {
     StackWithMin swm = new StackWithMin();
     swm.Push(2);
     swm.Push(1);
     swm.Push(3);
     swm.Push(4);
     int min = swm.Min();
     int[] poppedItem = new int[4];
     int i = 0;
     while (swm.Count() > 0)
     {
         poppedItem[i++] = swm.Pop();
     }
     Assert.AreEqual(new int[] { 4, 3, 1, 2 }, poppedItem);
     Assert.AreEqual(1, min);
 }