public void NextWord() { InterpreterStream stream = new InterpreterStream(); Assert.AreEqual(0, stream.Next()); stream.Push(new byte[] { 0x10, 0x20, 0xFF, 0xFF, 0x80, 0x00 }); Assert.IsTrue(stream.HasNext()); Assert.AreEqual(0x1020, stream.NextWord()); Assert.IsTrue(stream.HasNext()); Assert.AreEqual(-1, stream.NextWord()); Assert.IsTrue(stream.HasNext()); Assert.AreEqual(-0x8000, stream.NextWord()); Assert.IsFalse(stream.HasNext()); Assert.AreEqual(0, stream.NextWord()); }
public void Position() { InterpreterStream stream = new InterpreterStream(); Assert.AreEqual(0, stream.Position); stream.Push(new byte[] { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 }); Assert.AreEqual(0, stream.Position); stream.Next(); Assert.AreEqual(1, stream.Position); stream.NextWord(); Assert.AreEqual(3, stream.Position); }