AjTalk.Tests.Language.BlockDecompilerTests.DecompileGetSetInstanceVariable C# (CSharp) Method

DecompileGetSetInstanceVariable() private method

private DecompileGetSetInstanceVariable ( ) : void
return void
        public void DecompileGetSetInstanceVariable()
        {
            Machine machine = new Machine();
            IClass cls = machine.CreateClass("TestClass");
            cls.DefineInstanceVariable("x");
            cls.DefineInstanceVariable("y");
            Block block = new Method(cls,"process");
            block.CompileByteCode(ByteCode.GetInstanceVariable, 0);
            block.CompileByteCode(ByteCode.SetInstanceVariable, 1);
            BlockDecompiler decompiler = new BlockDecompiler(block);

            var result = decompiler.Decompile();

            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual("GetInstanceVariable x", result[0]);
            Assert.AreEqual("SetInstanceVariable y", result[1]);
        }