Search in sources :

Example 81 with RealValue

use of org.evosuite.symbolic.expr.fp.RealValue in project evosuite by EvoSuite.

the class SymbolicObserver method castIfNeeded.

private Expression<?> castIfNeeded(Type elementType, Expression<?> symb_value) {
    // cast integer to real if needed
    if ((isFp32(elementType) || isFp64(elementType)) && symb_value instanceof IntegerValue) {
        IntegerValue intExpr = (IntegerValue) symb_value;
        double concValue = intExpr.getConcreteValue().doubleValue();
        symb_value = new IntegerToRealCast(intExpr, concValue);
    } else if ((isBv32(elementType) || isBv64(elementType)) && symb_value instanceof RealValue) {
        RealValue realExpr = (RealValue) symb_value;
        long concValue = realExpr.getConcreteValue().longValue();
        symb_value = new RealToIntegerCast(realExpr, concValue);
    }
    return symb_value;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) IntegerToRealCast(org.evosuite.symbolic.expr.fp.IntegerToRealCast) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) RealToIntegerCast(org.evosuite.symbolic.expr.bv.RealToIntegerCast)

Aggregations

RealValue (org.evosuite.symbolic.expr.fp.RealValue)81 Operator (org.evosuite.symbolic.expr.Operator)25 RealUnaryExpression (org.evosuite.symbolic.expr.fp.RealUnaryExpression)23 IntegerValue (org.evosuite.symbolic.expr.bv.IntegerValue)22 ReferenceExpression (org.evosuite.symbolic.expr.ref.ReferenceExpression)13 IntegerConstraint (org.evosuite.symbolic.expr.IntegerConstraint)12 ReferenceConstant (org.evosuite.symbolic.expr.ref.ReferenceConstant)11 Expression (org.evosuite.symbolic.expr.Expression)6 RealToIntegerCast (org.evosuite.symbolic.expr.bv.RealToIntegerCast)6 IntegerToRealCast (org.evosuite.symbolic.expr.fp.IntegerToRealCast)6 RealBinaryExpression (org.evosuite.symbolic.expr.fp.RealBinaryExpression)6 StringValue (org.evosuite.symbolic.expr.str.StringValue)4 PrimitiveExpression (org.evosuite.testcase.statements.PrimitiveExpression)4 Type (org.objectweb.asm.Type)4 CodeUnderTestException (org.evosuite.testcase.execution.CodeUnderTestException)3 Field (java.lang.reflect.Field)2 RealComparison (org.evosuite.symbolic.expr.bv.RealComparison)2 EvosuiteError (org.evosuite.testcase.execution.EvosuiteError)2 VariableReference (org.evosuite.testcase.variable.VariableReference)2 SmtExpr (org.evosuite.symbolic.solver.smt.SmtExpr)1