builder1.addPackage( packageDescr1 );
if ( builder1.hasErrors() ) {
fail( builder1.getErrors().toString() );
}
final Pattern pattern1 = (Pattern) builder1.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final VariableConstraint returnValue1 = (VariableConstraint) pattern1.getConstraints().get( 0 );
final PackageBuilder builder2 = new PackageBuilder();
final PackageDescr packageDescr2 = new PackageDescr( "package2" );
createReturnValueRule( packageDescr2,
" x + y " );
builder2.addPackage( packageDescr2 );
final Pattern pattern2 = (Pattern) builder2.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final VariableConstraint returnValue2 = (VariableConstraint) pattern2.getConstraints().get( 0 );
final PackageBuilder builder3 = new PackageBuilder();
final PackageDescr packageDescr3 = new PackageDescr( "package3" );
createReturnValueRule( packageDescr3,
" x - y " );
builder3.addPackage( packageDescr3 );
final Pattern pattern3 = (Pattern) builder3.getPackage().getRules()[0].getLhs().getChildren().get( 0 );
final VariableConstraint returnValue3 = (VariableConstraint) pattern3.getConstraints().get( 0 );
assertEquals( returnValue1,
returnValue2 );
assertFalse( returnValue1.equals( returnValue3 ) );
assertFalse( returnValue2.equals( returnValue3 ) );