LogicalExpressionPlan plan = new LogicalExpressionPlan();
ConstantExpression constant1 = new ConstantExpression(plan, 10);
ConstantExpression constant2 = new ConstantExpression(plan, 20L);
ConstantExpression constant3 = new ConstantExpression(plan, 123);
ModExpression mod1 = new ModExpression(plan, constant1, constant2);
EqualExpression equal1 = new EqualExpression(plan, mod1, 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.LONG, mod1.getType());
assertEquals(DataType.BOOLEAN, equal1.getType());
// Cast insertion check
assertEquals(DataType.LONG, mod1.getLhs().getType());
assertEquals(DataType.LONG, equal1.getRhs().getType());
}