public void StackTrimExcess(int index) { int expectedLength; if (index <= 5) { expectedLength = index + 1; } else { expectedLength = index + Convert.ToInt32((1d / 10d) * index); } var s = new StosWTablicy <int>(); for (int i = 0; i < index; i++) { s.Push(1); } s.TrimExcess(); Assert.AreEqual(expectedLength, s.Length()); }