use of org.evosuite.symbolic.expr.bv.StringComparison in project evosuite by EvoSuite.
the class ConstraintNormalizer method createStringConstraint.
private static Constraint<?> createStringConstraint(IntegerConstraint c) {
if (c.getLeftOperand() instanceof StringComparison) {
StringComparison string_comparison = (StringComparison) c.getLeftOperand();
@SuppressWarnings("unchecked") Expression<Long> number_expr = (Expression<Long>) c.getRightOperand();
IntegerConstant constant = new IntegerConstant(number_expr.getConcreteValue());
return new StringConstraint(string_comparison, c.getComparator(), constant);
} else {
assert c.getRightOperand() instanceof StringComparison;
StringComparison string_comparison = (StringComparison) c.getRightOperand();
@SuppressWarnings("unchecked") Expression<Long> number_expr = (Expression<Long>) c.getLeftOperand();
IntegerConstant constant = new IntegerConstant(number_expr.getConcreteValue());
return new StringConstraint(string_comparison, c.getComparator(), constant);
}
}
use of org.evosuite.symbolic.expr.bv.StringComparison in project evosuite by EvoSuite.
the class ConstraintToZ3Visitor method visit.
@Override
public SmtExpr visit(StringConstraint c, Void arg) {
ExprToZ3Visitor v = new ExprToZ3Visitor();
StringComparison stringComparison = (StringComparison) c.getLeftOperand();
IntegerConstant integerConstant = (IntegerConstant) c.getRightOperand();
SmtExpr left = stringComparison.accept(v, null);
SmtExpr right = integerConstant.accept(v, null);
if (left == null || right == null) {
return null;
}
Comparator cmp = c.getComparator();
return mkComparison(left, cmp, right);
}
Aggregations