Exemple #1
0
        public void ExprParser_Parse_HandlesAddExpression()
        {
            string          expr     = "2+3";
            InputTextStream inStream = new InputTextStream(expr);

            ExprParser parser = new ExprParser();
            ExprOp     result = parser.Parse(inStream);

            Assert.IsNotNull(result);
            Assert.AreEqual(OpKindEnum.O_ADD, result.Kind);
            Assert.AreEqual(2, result.Left.AsValue.AsLong);
            Assert.AreEqual(3, result.Right.AsValue.AsLong);

            // Just in case...
            EmptyScope scope = new EmptyScope();
            Value      val   = result.Calc(scope);

            Assert.AreEqual(5, val.AsLong);
        }
Exemple #2
0
        public void EmptyScope_Define_DoesNothing()
        {
            var scope = new EmptyScope();

            scope.Define(SymbolKindEnum.COMMAND, "none", null); // just to check that there is no exceptions
        }