Search in sources :

Example 26 with Operator

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

the class ExprToCVC4Visitor method visit.

@Override
public SmtExpr visit(StringUnaryExpression e, Void v) {
    SmtExpr operand = e.getOperand().accept(this, null);
    if (operand == null) {
        return null;
    }
    if (!operand.isSymbolic()) {
        String stringValue = e.getConcreteValue();
        return SmtExprBuilder.mkStringConstant(stringValue);
    }
    Operator op = e.getOperator();
    switch(op) {
        case TRIM:
        case TOLOWERCASE:
        case TOUPPERCASE:
            {
                String stringValue = e.getConcreteValue();
                return SmtExprBuilder.mkStringConstant(stringValue);
            }
        default:
            throw new IllegalArgumentException("The operation " + op + " is not a unary string operation");
    }
}
Also used : Operator(org.evosuite.symbolic.expr.Operator) SmtExpr(org.evosuite.symbolic.solver.smt.SmtExpr)

Example 27 with Operator

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

the class CEIL method executeFunction.

@Override
public Object executeFunction() {
    double res = this.getConcDoubleRetVal();
    RealValue realExpression = this.getSymbRealArgument(0);
    RealValue ceilExpr;
    if (realExpression.containsSymbolicVariable()) {
        Operator op = Operator.CEIL;
        ceilExpr = new RealUnaryExpression(realExpression, op, res);
    } else {
        ceilExpr = this.getSymbRealRetVal();
    }
    return ceilExpr;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) Operator(org.evosuite.symbolic.expr.Operator) RealUnaryExpression(org.evosuite.symbolic.expr.fp.RealUnaryExpression)

Example 28 with Operator

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

the class EXP method executeFunction.

@Override
public Object executeFunction() {
    double res = this.getConcDoubleRetVal();
    RealValue realExpression = this.getSymbRealArgument(0);
    RealValue expExpr;
    if (realExpression.containsSymbolicVariable()) {
        Operator op = Operator.EXP;
        expExpr = new RealUnaryExpression(realExpression, op, res);
    } else {
        expExpr = this.getSymbRealRetVal();
    }
    return expExpr;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) Operator(org.evosuite.symbolic.expr.Operator) RealUnaryExpression(org.evosuite.symbolic.expr.fp.RealUnaryExpression)

Example 29 with Operator

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

the class LOG method executeFunction.

@Override
public Object executeFunction() {
    double res = this.getConcDoubleRetVal();
    RealValue realExpression = this.getSymbRealArgument(0);
    RealValue logExpr;
    if (realExpression.containsSymbolicVariable()) {
        Operator op = Operator.LOG;
        logExpr = new RealUnaryExpression(realExpression, op, res);
    } else {
        logExpr = this.getSymbRealRetVal();
    }
    return logExpr;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) Operator(org.evosuite.symbolic.expr.Operator) RealUnaryExpression(org.evosuite.symbolic.expr.fp.RealUnaryExpression)

Example 30 with Operator

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

the class ACOS method executeFunction.

@Override
public Object executeFunction() {
    double res = this.getConcDoubleRetVal();
    RealValue realExpression = this.getSymbRealArgument(0);
    RealValue acosExpr;
    if (realExpression.containsSymbolicVariable()) {
        Operator op = Operator.ACOS;
        acosExpr = new RealUnaryExpression(realExpression, op, res);
    } else {
        acosExpr = this.getSymbRealRetVal();
    }
    return acosExpr;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) Operator(org.evosuite.symbolic.expr.Operator) RealUnaryExpression(org.evosuite.symbolic.expr.fp.RealUnaryExpression)

Aggregations

Operator (org.evosuite.symbolic.expr.Operator)39 RealUnaryExpression (org.evosuite.symbolic.expr.fp.RealUnaryExpression)25 RealValue (org.evosuite.symbolic.expr.fp.RealValue)25 SmtExpr (org.evosuite.symbolic.solver.smt.SmtExpr)14 RealBinaryExpression (org.evosuite.symbolic.expr.fp.RealBinaryExpression)8 LinkedList (java.util.LinkedList)5 Expression (org.evosuite.symbolic.expr.Expression)4 IntegerBinaryExpression (org.evosuite.symbolic.expr.bv.IntegerBinaryExpression)4 IntegerUnaryExpression (org.evosuite.symbolic.expr.bv.IntegerUnaryExpression)4 RealUnaryToIntegerExpression (org.evosuite.symbolic.expr.bv.RealUnaryToIntegerExpression)4 StringBinaryToIntegerExpression (org.evosuite.symbolic.expr.bv.StringBinaryToIntegerExpression)4 StringMultipleToIntegerExpression (org.evosuite.symbolic.expr.bv.StringMultipleToIntegerExpression)4 StringUnaryToIntegerExpression (org.evosuite.symbolic.expr.bv.StringUnaryToIntegerExpression)4 GetFieldExpression (org.evosuite.symbolic.expr.ref.GetFieldExpression)4 StringBinaryExpression (org.evosuite.symbolic.expr.str.StringBinaryExpression)4 StringMultipleExpression (org.evosuite.symbolic.expr.str.StringMultipleExpression)4 StringUnaryExpression (org.evosuite.symbolic.expr.str.StringUnaryExpression)4 SmtIntConstant (org.evosuite.symbolic.solver.smt.SmtIntConstant)3 RegExp (dk.brics.automaton.RegExp)1 SmtStringConstant (org.evosuite.symbolic.solver.smt.SmtStringConstant)1