Search in sources :

Example 16 with ReferenceExpression

use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.

the class SymbolicHeap method array_load.

public StringValue array_load(ReferenceExpression symb_array, int conc_index, String conc_value) {
    Map<Integer, Expression<?>> symb_array_contents = getOrCreateSymbolicArray(symb_array);
    StringValue symb_value = (StringValue) symb_array_contents.get(conc_index);
    if (symb_value == null || !((String) symb_value.getConcreteValue()).equals(conc_value)) {
        symb_value = ExpressionFactory.buildNewStringConstant(conc_value);
        symb_array_contents.remove(conc_index);
    }
    return symb_value;
}
Also used : Expression(org.evosuite.symbolic.expr.Expression) ReferenceExpression(org.evosuite.symbolic.expr.ref.ReferenceExpression) StringValue(org.evosuite.symbolic.expr.str.StringValue)

Example 17 with ReferenceExpression

use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.

the class SymbolicHeap method array_load.

public RealValue array_load(ReferenceExpression symb_array, int conc_index, double conc_value) {
    Map<Integer, Expression<?>> symb_array_contents = getOrCreateSymbolicArray(symb_array);
    RealValue symb_value = (RealValue) symb_array_contents.get(conc_index);
    if (symb_value == null || ((Double) symb_value.getConcreteValue()).doubleValue() != conc_value) {
        symb_value = ExpressionFactory.buildNewRealConstant(conc_value);
        symb_array_contents.remove(conc_index);
    }
    return symb_value;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) Expression(org.evosuite.symbolic.expr.Expression) ReferenceExpression(org.evosuite.symbolic.expr.ref.ReferenceExpression)

Example 18 with ReferenceExpression

use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.

the class SymbolicHeap method getField.

/**
 * @param className
 * @param fieldName
 * @param conc_receiver
 * @param symb_receiver
 * @param conc_value
 * @return
 */
public RealValue getField(String className, String fieldName, Object conc_receiver, ReferenceExpression symb_receiver, double conc_value) {
    Map<ReferenceExpression, Expression<?>> symb_field = getOrCreateSymbolicField(className, fieldName);
    RealValue symb_value = (RealValue) symb_field.get(symb_receiver);
    if (symb_value == null || ((Double) symb_value.getConcreteValue()).doubleValue() != conc_value) {
        symb_value = ExpressionFactory.buildNewRealConstant(conc_value);
        symb_field.remove(symb_receiver);
    }
    return symb_value;
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) Expression(org.evosuite.symbolic.expr.Expression) ReferenceExpression(org.evosuite.symbolic.expr.ref.ReferenceExpression) ReferenceExpression(org.evosuite.symbolic.expr.ref.ReferenceExpression)

Example 19 with ReferenceExpression

use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.

the class SymbolicFunctionVM method INVOKESPECIAL.

@Override
public void INVOKESPECIAL(String owner, String name, String desc) {
    functionUnderExecution = getFunction(owner, name, desc);
    if (functionUnderExecution != null) {
        ReferenceExpression symb_receiver = getReceiverFromStack();
        functionUnderExecution.setReceiver(null, /* receiver not yet ready */
        symb_receiver);
        if (Type.getArgumentTypes(desc).length == 0) {
            callBeforeExecution(functionUnderExecution);
        }
    }
}
Also used : ReferenceExpression(org.evosuite.symbolic.expr.ref.ReferenceExpression)

Example 20 with ReferenceExpression

use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.

the class SymbolicFunctionVM method CALLER_STACK_PARAM.

@Override
public void CALLER_STACK_PARAM(int nr, int calleeLocalsIndex, Object conc_arg) {
    if (functionUnderExecution != null) {
        ReferenceExpression symb_arg = getReferenceFromStack(nr);
        functionUnderExecution.setParam(nr, conc_arg, symb_arg);
        beforeExecuteFunction(nr);
    }
}
Also used : ReferenceExpression(org.evosuite.symbolic.expr.ref.ReferenceExpression)

Aggregations

ReferenceExpression (org.evosuite.symbolic.expr.ref.ReferenceExpression)73 IntegerValue (org.evosuite.symbolic.expr.bv.IntegerValue)27 IntegerConstraint (org.evosuite.symbolic.expr.IntegerConstraint)19 ReferenceConstant (org.evosuite.symbolic.expr.ref.ReferenceConstant)18 StringValue (org.evosuite.symbolic.expr.str.StringValue)16 Expression (org.evosuite.symbolic.expr.Expression)13 RealValue (org.evosuite.symbolic.expr.fp.RealValue)13 VariableReference (org.evosuite.testcase.variable.VariableReference)11 Type (org.objectweb.asm.Type)9 CodeUnderTestException (org.evosuite.testcase.execution.CodeUnderTestException)6 PrimitiveExpression (org.evosuite.testcase.statements.PrimitiveExpression)5 Field (java.lang.reflect.Field)3 StringBinaryComparison (org.evosuite.symbolic.expr.bv.StringBinaryComparison)3 Method (java.lang.reflect.Method)2 StringMultipleExpression (org.evosuite.symbolic.expr.str.StringMultipleExpression)2 EvosuiteError (org.evosuite.testcase.execution.EvosuiteError)2 ArrayReference (org.evosuite.testcase.variable.ArrayReference)2 BigInteger (java.math.BigInteger)1 Matcher (java.util.regex.Matcher)1 EvoSuiteFile (org.evosuite.runtime.testdata.EvoSuiteFile)1