public void Push(int[] data) { var stack = new Algorithms.Stacks.LinkedStack <int>(); foreach (var item in data) { stack.Push(item); } Assert.AreEqual(stack.Size, data.Length); }
public void Pop_N(int[] data) { var stack = new Algorithms.Stacks.LinkedStack <int>(); foreach (var item in data) { stack.Push(item); } Assert.AreEqual(stack.Size, data.Length); var results = stack.Pop(data.Length).Reverse().ToArray(); CollectionAssert.AreEqual(results, data); }
public void Pop(int[] data) { var stack = new Algorithms.Stacks.LinkedStack <int>(); foreach (var item in data) { stack.Push(item); } Assert.AreEqual(stack.Size, data.Length); var results = new int[data.Length]; for (int i = data.Length - 1; i >= 0; i--) { results[i] = stack.Pop(); } CollectionAssert.AreEqual(results, data); }