ConstantExpression constant2 = new ConstantExpression(expPlan, 20D) ;
ConstantExpression constant3 = new ConstantExpression(expPlan, 123f) ;
AddExpression add1 = new AddExpression(expPlan, constant1, constant2) ;
CastExpression cast1 = new CastExpression(expPlan,constant3, createFS(DataType.DOUBLE)) ;
MultiplyExpression mul1 = new MultiplyExpression(expPlan, add1, cast1) ;
CompilationMessageCollector collector = new CompilationMessageCollector() ;
TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(expPlan, collector, null);
expTypeChecker.visit();
printMessageCollector(collector) ;
//printTypeGraph(plan) ;
if (collector.hasError()) {
throw new Exception("Error during type checking") ;
}
// Induction check
assertEquals(DataType.DOUBLE, add1.getType()) ;
assertEquals(DataType.DOUBLE, mul1.getType()) ;
// Cast insertion check
assertEquals(DataType.DOUBLE, add1.getLhs().getType()) ;
assertEquals(DataType.DOUBLE, mul1.getRhs().getType()) ;
}