public void MyTest2() { sizedStack <int> sizedStack = new sizedStack <int>(1); Assert.AreEqual(true, sizedStack.Push(8)); Assert.AreEqual(false, sizedStack.Push(7)); Assert.AreEqual(8, sizedStack.Pop()); try { sizedStack.Pop(); } catch (Exception e) { Assert.AreEqual("Стек пуст", e.Message); } }
public void BaseStackTest() { sizedStack <int> sizedStack = new sizedStack <int>(); Assert.AreEqual(true, sizedStack.Push(3)); Assert.AreEqual(true, sizedStack.Push(5)); Assert.AreEqual(true, sizedStack.Push(7)); Assert.AreEqual(7, sizedStack.Pop()); Assert.AreEqual(true, sizedStack.Push(8)); Assert.AreEqual(8, sizedStack.Pop()); Assert.AreEqual(5, sizedStack.Pop()); Assert.AreEqual(true, sizedStack.Push(1)); Assert.AreEqual(1, sizedStack.Pop()); Assert.AreEqual(3, sizedStack.Pop()); }
public void MyTest4() { int[] test = new int[] { 1 }; sizedStack <int> sizedStack = new sizedStack <int>(test, false); Assert.AreEqual(true, sizedStack.Push(8)); Assert.AreEqual(test[0], sizedStack.Pop()); }