Search in sources :

Example 1 with Comparator

use of org.evosuite.symbolic.expr.Comparator in project evosuite by EvoSuite.

the class ConstraintToZ3Str2Visitor method visit.

@Override
public SmtExpr visit(RealConstraint c, Void arg) {
    ExprToZ3Str2Visitor v = new ExprToZ3Str2Visitor();
    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);
}
Also used : SmtExpr(org.evosuite.symbolic.solver.smt.SmtExpr) Comparator(org.evosuite.symbolic.expr.Comparator)

Example 2 with Comparator

use of org.evosuite.symbolic.expr.Comparator in project evosuite by EvoSuite.

the class ConstraintNormalizer method createRealConstraint.

private static Constraint<?> createRealConstraint(IntegerConstraint c) {
    if (c.getLeftOperand() instanceof RealComparison) {
        RealComparison cmp = (RealComparison) c.getLeftOperand();
        int value = ((Number) c.getRightOperand().getConcreteValue()).intValue();
        Comparator op = c.getComparator();
        Expression<Double> cmp_left = cmp.getLeftOperant();
        Expression<Double> cmp_right = cmp.getRightOperant();
        return createRealConstraint(cmp_left, op, cmp_right, value);
    } else {
        assert (c.getRightOperand() instanceof RealComparison);
        RealComparison cmp = (RealComparison) c.getRightOperand();
        Comparator op = c.getComparator();
        Comparator swap_op = op.swap();
        int value = ((Number) c.getLeftOperand().getConcreteValue()).intValue();
        int swap_value = -value;
        Expression<Double> cmp_left = cmp.getLeftOperant();
        Expression<Double> cmp_right = cmp.getRightOperant();
        return createRealConstraint(cmp_left, swap_op, cmp_right, swap_value);
    }
}
Also used : RealComparison(org.evosuite.symbolic.expr.bv.RealComparison) RealConstraint(org.evosuite.symbolic.expr.RealConstraint) StringConstraint(org.evosuite.symbolic.expr.StringConstraint) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint) Constraint(org.evosuite.symbolic.expr.Constraint) Comparator(org.evosuite.symbolic.expr.Comparator)

Example 3 with Comparator

use of org.evosuite.symbolic.expr.Comparator in project evosuite by EvoSuite.

the class ConstraintToCVC4Visitor method visit.

@Override
public SmtExpr visit(IntegerConstraint c, Void arg) {
    Expression<?> leftOperand = c.getLeftOperand();
    Expression<?> rightOperand = c.getRightOperand();
    Comparator cmp = c.getComparator();
    return visit(leftOperand, cmp, rightOperand);
}
Also used : Comparator(org.evosuite.symbolic.expr.Comparator)

Example 4 with Comparator

use of org.evosuite.symbolic.expr.Comparator in project evosuite by EvoSuite.

the class ConstraintToCVC4Visitor method visit.

@Override
public SmtExpr visit(StringConstraint c, Void arg) {
    Expression<?> leftOperand = c.getLeftOperand();
    Expression<?> rightOperand = c.getRightOperand();
    Comparator cmp = c.getComparator();
    return visit(leftOperand, cmp, rightOperand);
}
Also used : Comparator(org.evosuite.symbolic.expr.Comparator)

Example 5 with Comparator

use of org.evosuite.symbolic.expr.Comparator in project evosuite by EvoSuite.

the class ConstraintToCVC4Visitor method visit.

@Override
public SmtExpr visit(RealConstraint c, Void arg) {
    Expression<?> leftOperand = c.getLeftOperand();
    Expression<?> rightOperand = c.getRightOperand();
    Comparator cmp = c.getComparator();
    return visit(leftOperand, cmp, rightOperand);
}
Also used : Comparator(org.evosuite.symbolic.expr.Comparator)

Aggregations

Comparator (org.evosuite.symbolic.expr.Comparator)12 SmtExpr (org.evosuite.symbolic.solver.smt.SmtExpr)6 Constraint (org.evosuite.symbolic.expr.Constraint)2 IntegerConstraint (org.evosuite.symbolic.expr.IntegerConstraint)2 RealConstraint (org.evosuite.symbolic.expr.RealConstraint)2 StringConstraint (org.evosuite.symbolic.expr.StringConstraint)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 BranchCondition (org.evosuite.symbolic.BranchCondition)1 IntegerComparison (org.evosuite.symbolic.expr.bv.IntegerComparison)1 IntegerConstant (org.evosuite.symbolic.expr.bv.IntegerConstant)1 RealComparison (org.evosuite.symbolic.expr.bv.RealComparison)1 StringComparison (org.evosuite.symbolic.expr.bv.StringComparison)1 TestChromosome (org.evosuite.testcase.TestChromosome)1