Search in sources :

Example 6 with IntegerToRealCast

use of org.evosuite.symbolic.expr.fp.IntegerToRealCast 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

IntegerValue (org.evosuite.symbolic.expr.bv.IntegerValue)6 IntegerToRealCast (org.evosuite.symbolic.expr.fp.IntegerToRealCast)6 RealValue (org.evosuite.symbolic.expr.fp.RealValue)6 IntegerConstraint (org.evosuite.symbolic.expr.IntegerConstraint)2 RealToIntegerCast (org.evosuite.symbolic.expr.bv.RealToIntegerCast)2 Expression (org.evosuite.symbolic.expr.Expression)1 ReferenceConstant (org.evosuite.symbolic.expr.ref.ReferenceConstant)1 ReferenceExpression (org.evosuite.symbolic.expr.ref.ReferenceExpression)1 PrimitiveExpression (org.evosuite.testcase.statements.PrimitiveExpression)1 VariableReference (org.evosuite.testcase.variable.VariableReference)1 Type (org.objectweb.asm.Type)1