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); }
public override Expr ConstructBinaryOp() => Add.Create(this.Left, this.Right);