Search in sources :

Example 36 with RealValue

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

the class SymbolicHeap method getStaticField.

public RealValue getStaticField(String owner, String name, double conc_value) {
    FieldKey k = new FieldKey(owner, name);
    RealValue symb_value = (RealValue) symb_static_fields.get(k);
    if (symb_value == null || ((Double) symb_value.getConcreteValue()).doubleValue() != conc_value) {
        symb_value = ExpressionFactory.buildNewRealConstant(conc_value);
        symb_static_fields.remove(k);
    }
    return symb_value;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue)

Example 37 with RealValue

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

the class SymbolicFunctionVM method CALL_RESULT.

@Override
public void CALL_RESULT(float conc_ret_val, String owner, String name, String desc) {
    if (functionUnderExecution != null) {
        if (!functionUnderExecution.getOwner().equals(owner) || !functionUnderExecution.getName().equals(name) || !functionUnderExecution.getDesc().equals(desc)) {
            functionUnderExecution = null;
        }
    }
    if (functionUnderExecution != null) {
        RealValue symb_ret_val = this.env.topFrame().operandStack.peekFp32();
        functionUnderExecution.setReturnValue(conc_ret_val, symb_ret_val);
        RealValue new_symb_ret_val = (RealValue) functionUnderExecution.executeFunction();
        this.replaceTopFp32(new_symb_ret_val);
    }
    functionUnderExecution = null;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue)

Example 38 with RealValue

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

the class SymbolicFunctionVM method CALL_RESULT.

@Override
public void CALL_RESULT(double conc_ret_val, String owner, String name, String desc) {
    if (functionUnderExecution != null) {
        if (!functionUnderExecution.getOwner().equals(owner) || !functionUnderExecution.getName().equals(name) || !functionUnderExecution.getDesc().equals(desc)) {
            functionUnderExecution = null;
        }
    }
    if (functionUnderExecution != null) {
        RealValue symb_ret_val = this.env.topFrame().operandStack.peekFp64();
        functionUnderExecution.setReturnValue(conc_ret_val, symb_ret_val);
        RealValue new_symb_ret_val = (RealValue) functionUnderExecution.executeFunction();
        this.replaceTopFp64(new_symb_ret_val);
    }
    functionUnderExecution = null;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue)

Example 39 with RealValue

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

the class SymbolicFunctionVM method CALLER_STACK_PARAM.

@Override
public void CALLER_STACK_PARAM(int nr, int calleeLocalsIndex, float conc_arg) {
    if (functionUnderExecution != null) {
        RealValue symb_arg = getRealExprFromStack(nr);
        functionUnderExecution.setParam(nr, conc_arg, symb_arg);
        beforeExecuteFunction(nr);
    }
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue)

Example 40 with RealValue

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

the class ArithmeticVM method F2I.

@Override
public void F2I() {
    RealValue realExpr = env.topFrame().operandStack.popFp32();
    float doubleValue = ((Double) realExpr.getConcreteValue()).floatValue();
    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)

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