ConstantExpression constant2 = new ConstantExpression(plan, 20L);
ConstantExpression constant3 = new ConstantExpression(plan, Boolean.TRUE);
GreaterThanExpression gt1 = new GreaterThanExpression(plan, constant1, constant2);
EqualExpression equal1 = new EqualExpression(plan, gt1, constant3);
NotEqualExpression nq1 = new NotEqualExpression(plan, gt1, constant3);
CompilationMessageCollector collector = new CompilationMessageCollector();
TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(
plan, collector, null);
expTypeChecker.visit();
plan.explain(System.out, "text", true);
printMessageCollector(collector);
// printTypeGraph(plan) ;
if (collector.hasError()) {
throw new Exception("Error during type checking");
}
// Induction check
assertEquals(DataType.BOOLEAN, gt1.getType());
assertEquals(DataType.BOOLEAN, equal1.getType());
assertEquals(DataType.BOOLEAN, nq1.getType());
// Cast insertion check
assertEquals(DataType.LONG, gt1.getLhs().getType());
assertEquals(DataType.BOOLEAN, equal1.getRhs().getType());
assertEquals(DataType.BOOLEAN, nq1.getRhs().getType());
}