示例#1
0
        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);
        }
示例#2
0
        public void ConditionalJumpWhenTrue()
        {
            var compiler = new BytecodeCompiler();

            compiler.Push(1);
            compiler.Push(11);
            compiler.JumpI();
            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);
        }