Addition There are two kinds of addition: 1. both operands are of arithmetic Type 2. one operand is a pointer, and the other is an integral
Inheritance: BinaryArithmeticOp
        public void Evaluate_Add_Test()
        {
            Expression left = CreateIntLiteral(1);
            Expression right = CreateIntLiteral(1);

            Expression add = new Add(left, right, pos);

            Values.Int value = ((Values.Int)add.Accept(evaluator));

            Assert.IsTrue(value.GetValue() == 2);
        }
        public void Conditional_Expression_Is_BoolType_InCorrect_Test()
        {
            List<FormObject> formObjects = new List<FormObject>();

            Expression and = new Add(
                new Int(2, position),
                new Int(1, position),
                position);

            Conditional conditional = new Conditional(and, null, position);

            formObjects.Add(conditional);

            ExpressionContainerChecker expressionContainerChecker = new ExpressionContainerChecker(manager, null);
            INotificationManager notificationManager = expressionContainerChecker.AnalyzeAndReport(formObjects);

            Assert.IsTrue(notificationManager.GetNotifications().Count == 1);
        }
Exemple #3
0
 public override Expr ConstructBinaryOp() => Add.Create(this.Left, this.Right);