Search in sources :

Example 41 with RealValue

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

the class ArithmeticVM method FDIV.

@Override
public void FDIV(float rhsValue) {
    RealValue right = env.topFrame().operandStack.popFp32();
    RealValue left = env.topFrame().operandStack.popFp32();
    float left_concrete_value = ((Double) left.getConcreteValue()).floatValue();
    float right_concrete_value = ((Double) right.getConcreteValue()).floatValue();
    if (!left.containsSymbolicVariable()) {
        left = ExpressionFactory.buildNewRealConstant(left_concrete_value);
    }
    if (!right.containsSymbolicVariable()) {
        right = ExpressionFactory.buildNewRealConstant(right_concrete_value);
    }
    float con = left_concrete_value / right_concrete_value;
    RealValue realExpr = ExpressionFactory.div(left, right, (double) con);
    env.topFrame().operandStack.pushFp32(realExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue)

Example 42 with RealValue

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

the class ArithmeticVM method FNEG.

@Override
public void FNEG() {
    RealValue param = env.topFrame().operandStack.popFp32();
    float param_concrete_value = ((Double) param.getConcreteValue()).floatValue();
    if (!param.containsSymbolicVariable()) {
        param = ExpressionFactory.buildNewRealConstant(param_concrete_value);
    }
    float con = -param_concrete_value;
    RealValue realExpr = new RealUnaryExpression(param, Operator.NEG, (double) con);
    env.topFrame().operandStack.pushFp32(realExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) RealUnaryExpression(org.evosuite.symbolic.expr.fp.RealUnaryExpression)

Example 43 with RealValue

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

the class ArithmeticVM method D2L.

@Override
public void D2L() {
    RealValue realExpr = env.topFrame().operandStack.popFp64();
    double doubleValue = ((Double) realExpr.getConcreteValue()).doubleValue();
    IntegerValue intExpr;
    long concreteValue = (long) doubleValue;
    if (!realExpr.containsSymbolicVariable()) {
        intExpr = ExpressionFactory.buildNewIntegerConstant(concreteValue);
    } else {
        intExpr = new RealToIntegerCast(realExpr, concreteValue);
    }
    env.topFrame().operandStack.pushBv64(intExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) RealToIntegerCast(org.evosuite.symbolic.expr.bv.RealToIntegerCast)

Example 44 with RealValue

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

the class ArithmeticVM method L2F.

@Override
public void L2F() {
    IntegerValue integerExpr = env.topFrame().operandStack.popBv64();
    long longValue = ((Long) integerExpr.getConcreteValue()).longValue();
    RealValue realExpr;
    float concreteValue = (float) longValue;
    if (!integerExpr.containsSymbolicVariable()) {
        realExpr = ExpressionFactory.buildNewRealConstant(concreteValue);
    } else {
        realExpr = new IntegerToRealCast(integerExpr, (double) concreteValue);
    }
    env.topFrame().operandStack.pushFp32(realExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) IntegerToRealCast(org.evosuite.symbolic.expr.fp.IntegerToRealCast) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue)

Example 45 with RealValue

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

the class ArithmeticVM method DSUB.

@Override
public void DSUB() {
    RealValue right = env.topFrame().operandStack.popFp64();
    RealValue left = env.topFrame().operandStack.popFp64();
    double left_concrete_value = ((Double) left.getConcreteValue()).doubleValue();
    double right_concrete_value = ((Double) right.getConcreteValue()).doubleValue();
    if (!left.containsSymbolicVariable()) {
        left = ExpressionFactory.buildNewRealConstant(left_concrete_value);
    }
    if (!right.containsSymbolicVariable()) {
        right = ExpressionFactory.buildNewRealConstant(right_concrete_value);
    }
    double con = left_concrete_value - right_concrete_value;
    RealValue realExpr = new RealBinaryExpression(left, Operator.MINUS, right, con);
    env.topFrame().operandStack.pushFp64(realExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) RealBinaryExpression(org.evosuite.symbolic.expr.fp.RealBinaryExpression)

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