public void HasNext() { InterpreterStream stream = new InterpreterStream(); Assert.IsFalse(stream.HasNext()); stream.Push(new byte[] { 0x10, 0x20 }); Assert.IsTrue(stream.HasNext()); stream.Next(); Assert.IsTrue(stream.HasNext()); stream.Next(); Assert.IsFalse(stream.HasNext()); }
public void JROT() { InterpreterStream stream = new InterpreterStream(); Assert.AreEqual(0, stream.Next()); stream.Push(new byte[] { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 }); stream.JMPR(2); Assert.IsTrue(stream.HasNext()); Assert.AreEqual(0x30, stream.Next()); Assert.IsTrue(stream.HasNext()); stream.JMPR(-3); Assert.AreEqual(0x10, stream.Next()); }
public void Next() { InterpreterStream stream = new InterpreterStream(); Assert.AreEqual(0, stream.Next()); stream.Push(new byte[] { 0x10, 0x20 }); Assert.AreEqual(0x10, stream.Next()); Assert.AreEqual(0x20, stream.Next()); Assert.IsFalse(stream.HasNext()); Assert.AreEqual(0, stream.Next()); stream.Pop(); Assert.IsFalse(stream.HasNext()); Assert.AreEqual(0, stream.Next()); }
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); }
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()); }