use of org.evosuite.symbolic.expr.Comparator in project evosuite by EvoSuite.
the class ConstraintNormalizer method normalizeIntegerConstriant.
private static Constraint<?> normalizeIntegerConstriant(IntegerConstraint c) {
if (c.getLeftOperand() instanceof IntegerComparison) {
IntegerComparison cmp = (IntegerComparison) c.getLeftOperand();
int value = ((Number) c.getRightOperand().getConcreteValue()).intValue();
Comparator op = c.getComparator();
Expression<Long> cmp_left = cmp.getLeftOperant();
Expression<Long> cmp_right = cmp.getRightOperant();
return createIntegerConstraint(cmp_left, op, cmp_right, value);
} else {
assert (c.getRightOperand() instanceof IntegerComparison);
IntegerComparison cmp = (IntegerComparison) c.getRightOperand();
int value = ((Number) c.getLeftOperand().getConcreteValue()).intValue();
Comparator op = c.getComparator();
Expression<Long> cmp_left = cmp.getLeftOperant();
Expression<Long> cmp_right = cmp.getRightOperant();
Comparator swap_op = op.swap();
int swap_value = -value;
return createIntegerConstraint(cmp_left, swap_op, cmp_right, swap_value);
}
}
use of org.evosuite.symbolic.expr.Comparator in project evosuite by EvoSuite.
the class ConstraintToZ3Visitor method visit.
@Override
public SmtExpr visit(IntegerConstraint c, Void arg) {
ExprToZ3Visitor v = new ExprToZ3Visitor();
SmtExpr left = c.getLeftOperand().accept(v, null);
SmtExpr right = c.getRightOperand().accept(v, null);
if (left == null || right == null) {
return null;
}
Comparator cmp = c.getComparator();
return mkComparison(left, cmp, right);
}
Aggregations