public void testConcatNumberString() {
   Plus plus = new Plus(new Number(2), new Text("a"));
   plus.type = TextType.instance;
   ExpressionVisitor expressionVisitor = new ExpressionVisitor(new SymbolTable());
   Expression expression = expressionVisitor.visit(plus);
   assertTrue(expression instanceof Text);
   Text text = (Text) expression;
   assertEquals("2a", text.text);
 }
  public final void testAdditionBetweenIntegersSimplification() {
    Plus plus = new Plus();
    plus.left = new Number(2);
    plus.left.type = IntegerType.instance;
    plus.right = new Number(3);
    plus.right.type = IntegerType.instance;

    expressionSimplificationTester(plus, Number.class, IntegerType.instance, 5, true);
  }
 public void testConcatCantOptimize() {
   IdExpression id = new IdExpression("a");
   id.type = new IdType("A");
   Text text = new Text("a");
   text.type = TextType.instance;
   Plus plus = new Plus(text, id);
   plus.type = TextType.instance;
   ExpressionVisitor expressionVisitor = new ExpressionVisitor(new SymbolTable());
   Expression expression = expressionVisitor.visit(plus);
   assertTrue(expression instanceof Concat);
   Concat concat = (Concat) expression;
   assertEquals(text, concat.left);
   assertEquals(id, concat.right);
 }
 public final void testZeroPlusExp() {
   Plus p = new Plus();
   p.type = IntegerType.instance;
   operationWithZero(p, null, true, true);
 }