public void Test_Init() { ByteStack bs = new ByteStack(ENC.GetBytes("foo")); Assert.AreEqual("foo", bs.ToString()); bs.Push((byte)'t'); Assert.AreEqual("foot", bs.ToString()); bs = new ByteStack(ENC.GetBytes("f")); bs.Push((byte)'t'); Assert.AreEqual("ft", bs.ToString()); }
public void Test_Growth() { ByteStack bs = new ByteStack(4); bs.Push((byte)'b'); Assert.AreEqual("b", bs.ToString()); bs.Push((byte)'c'); Assert.AreEqual("bc", bs.ToString()); bs.Push((byte)'d'); Assert.AreEqual("bcd", bs.ToString()); bs.Push((byte)'e'); Assert.AreEqual("bcde", bs.ToString()); bs.Push((byte)'b'); Assert.AreEqual("bcdeb", bs.ToString()); bs.Push((byte)'c'); Assert.AreEqual("bcdebc", bs.ToString()); bs.Push((byte)'d'); Assert.AreEqual("bcdebcd", bs.ToString()); bs.Push((byte)'e'); Assert.AreEqual("bcdebcde", bs.ToString()); bs.Push((byte)'b'); bs.Push((byte)'c'); bs.Push((byte)'d'); bs.Push((byte)'e'); bs.Push((byte)'b'); bs.Push((byte)'c'); bs.Push((byte)'d'); bs.Push((byte)'e'); Assert.AreEqual("bcdebcdebcdebcde", bs.ToString()); }