public void InvalidTooLargeJump() { var compiler = new BytecodeCompiler(); compiler.Push(10000); compiler.Jump(); compiler.Push(2); compiler.Push(3); compiler.Push(4); Machine machine = new Machine(); machine.Execute(compiler.ToBytes()); var stack = machine.Stack; Assert.AreEqual(0, stack.Size); }
public void JumpPushes() { var compiler = new BytecodeCompiler(); compiler.Push(9); compiler.Jump(); compiler.Push(2); compiler.Push(3); compiler.Push(4); compiler.JumpDest(); Machine machine = new Machine(); machine.Execute(compiler.ToBytes()); var stack = machine.Stack; Assert.AreEqual(0, stack.Size); }
public void InvalidTooLargeJump() { var compiler = new BytecodeCompiler(); compiler.Push(10000); compiler.Jump(); compiler.Push(2); compiler.Push(3); compiler.Push(4); Machine machine = new Machine(); try { machine.Execute(compiler.ToBytes()); } catch (InvalidOperationException ex) { Assert.AreEqual("Invalid jump destination", ex.Message); } }
public void JumpWithoutJumpDest() { var compiler = new BytecodeCompiler(); compiler.Push(9); compiler.Jump(); compiler.Push(2); compiler.Push(3); compiler.Push(4); compiler.Push(5); Machine machine = new Machine(); try { machine.Execute(compiler.ToBytes()); Assert.Fail(); } catch (InvalidOperationException ex) { Assert.AreEqual("Invalid jump destination", ex.Message); } }