AjTalk.Tests.Compilers.Vm.BytecodeCompilerTests.CompileBlockWithTwoParameters C# (CSharp) Метод

CompileBlockWithTwoParameters() приватный Метод

private CompileBlockWithTwoParameters ( ) : void
Результат void
        public void CompileBlockWithTwoParameters()
        {
            ModelParser parser = new ModelParser("[:a :b | a+b]");
            this.compiler.CompileExpression(parser.ParseExpression());

            Assert.IsNotNull(this.block);
            Assert.AreEqual(0, this.block.NoGlobalNames);
            Assert.AreEqual(0, this.block.NoLocals);
            Assert.AreEqual(1, this.block.NoConstants);
            Assert.IsNotNull(this.block.ByteCodes);
            Assert.AreEqual(2, this.block.ByteCodes.Length);
            Assert.AreEqual(0, this.block.Arity);

            object constant = this.block.GetConstant(0);

            Assert.IsNotNull(constant);
            Assert.IsInstanceOfType(constant, typeof(Block));

            var newblock = (Block)constant;
            Assert.AreEqual(0, newblock.NoLocals);
            Assert.AreEqual(0, newblock.NoGlobalNames);
            Assert.AreEqual(1, newblock.NoConstants);
            Assert.IsNotNull(newblock.ByteCodes);
            Assert.AreEqual(7, newblock.ByteCodes.Length);
            Assert.AreEqual(2, newblock.Arity);
        }