Search in sources :

Example 26 with RealValue

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

the class ArithmeticVM method D2F.

@Override
public void D2F() {
    RealValue e = env.topFrame().operandStack.popFp64();
    env.topFrame().operandStack.pushFp32(e);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue)

Example 27 with RealValue

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

the class ArithmeticVM method DNEG.

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

Example 28 with RealValue

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

the class ArithmeticVM method D2I.

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

Example 29 with RealValue

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

the class ArithmeticVM method DREM.

@Override
public void DREM(double rhs) {
    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 = ExpressionFactory.rem(left, right, con);
    env.topFrame().operandStack.pushFp64(realExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue)

Example 30 with RealValue

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

the class ArithmeticVM method L2D.

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

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