示例#1
0
        [Test] public void EvaluateSymbol()
        {
            Expression     expr     = ExpressionParser.Parse("len");
            StructInstance instance = LoadDataTest.PrepareInstance("struct data { i32 len; }", new byte[] { 5, 0, 0, 0 });

            Assert.AreEqual(5, expr.Evaluate(instance));
        }
示例#2
0
        public void EvaluateParent()
        {
            Expression     expr     = ExpressionParser.Parse("parent.len");
            StructInstance instance = LoadDataTest.PrepareInstance(
                "struct data { i8 len; child ch; } struct ch { i8 len; } ",
                new byte[] { 5, 17, 0, 0 });

            Assert.AreEqual(5, expr.Evaluate(instance.Children[0] as StructInstance));
        }