Search in sources :

Example 86 with ReferenceConstant

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

the class B_ValueOf method executeFunction.

@Override
public Object executeFunction() {
    IntegerValue int_value = this.getSymbIntegerArgument(0);
    ReferenceConstant symb_byte = (ReferenceConstant) this.getSymbRetVal();
    Byte conc_byte = (Byte) this.getConcRetVal();
    env.heap.putField(Types.JAVA_LANG_BYTE, SymbolicHeap.$BYTE_VALUE, conc_byte, symb_byte, int_value);
    return symb_byte;
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue)

Example 87 with ReferenceConstant

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

the class ToString method executeFunction.

@Override
public Object executeFunction() {
    // object receiver
    ReferenceConstant symb_str = this.getSymbReceiver();
    String conc_str = (String) this.getConcReceiver();
    // return value
    String conc_ret_val = (String) this.getConcRetVal();
    ReferenceConstant symb_ret_val = (ReferenceConstant) this.getSymbRetVal();
    StringValue string_expr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_str, symb_str, conc_str);
    env.heap.putField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_ret_val, symb_ret_val, string_expr);
    return this.getSymbRetVal();
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant) StringValue(org.evosuite.symbolic.expr.str.StringValue)

Example 88 with ReferenceConstant

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

the class Trim method executeFunction.

@Override
public Object executeFunction() {
    // object receiver
    ReferenceConstant symb_str = this.getSymbReceiver();
    String conc_str = (String) this.getConcReceiver();
    // return value
    String conc_ret_val = (String) this.getConcRetVal();
    ReferenceConstant symb_ret_val = (ReferenceConstant) this.getSymbRetVal();
    StringValue string_expr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_str, symb_str, conc_str);
    StringUnaryExpression symb_value = new StringUnaryExpression(string_expr, Operator.TRIM, conc_ret_val);
    env.heap.putField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_ret_val, symb_ret_val, symb_value);
    return this.getSymbRetVal();
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant) StringUnaryExpression(org.evosuite.symbolic.expr.str.StringUnaryExpression) StringValue(org.evosuite.symbolic.expr.str.StringValue)

Example 89 with ReferenceConstant

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

the class SymbolicObserver method after.

private void after(BytePrimitiveStatement statement, Scope scope) {
    byte valueOf = statement.getValue();
    VariableReference varRef = statement.getReturnValue();
    String varRefName = varRef.getName();
    IntegerVariable integerVariable = buildIntegerVariable(varRefName, valueOf, Byte.MIN_VALUE, Byte.MAX_VALUE);
    symb_expressions.put(varRefName, integerVariable);
    Byte byte_instance;
    try {
        byte_instance = (Byte) varRef.getObject(scope);
    } catch (CodeUnderTestException e) {
        throw new EvosuiteError(e);
    }
    ReferenceConstant byteRef = newByteReference(byte_instance, integerVariable);
    symb_references.put(varRefName, byteRef);
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant) IntegerVariable(org.evosuite.symbolic.expr.bv.IntegerVariable) VariableReference(org.evosuite.testcase.variable.VariableReference) EvosuiteError(org.evosuite.testcase.execution.EvosuiteError) CodeUnderTestException(org.evosuite.testcase.execution.CodeUnderTestException)

Example 90 with ReferenceConstant

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

the class SymbolicObserver method newShortReference.

private ReferenceConstant newShortReference(Short conc_short, IntegerValue symb_value) {
    ReferenceConstant shortRef = (ReferenceConstant) env.heap.getReference(conc_short);
    env.heap.putField(Types.JAVA_LANG_SHORT, SymbolicHeap.$SHORT_VALUE, conc_short, shortRef, symb_value);
    return shortRef;
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant)

Aggregations

ReferenceConstant (org.evosuite.symbolic.expr.ref.ReferenceConstant)99 StringValue (org.evosuite.symbolic.expr.str.StringValue)39 IntegerValue (org.evosuite.symbolic.expr.bv.IntegerValue)32 ReferenceExpression (org.evosuite.symbolic.expr.ref.ReferenceExpression)18 CodeUnderTestException (org.evosuite.testcase.execution.CodeUnderTestException)16 VariableReference (org.evosuite.testcase.variable.VariableReference)14 Type (org.objectweb.asm.Type)12 RealValue (org.evosuite.symbolic.expr.fp.RealValue)11 EvosuiteError (org.evosuite.testcase.execution.EvosuiteError)11 Expression (org.evosuite.symbolic.expr.Expression)9 StringBinaryComparison (org.evosuite.symbolic.expr.bv.StringBinaryComparison)8 IntegerVariable (org.evosuite.symbolic.expr.bv.IntegerVariable)6 PrimitiveExpression (org.evosuite.testcase.statements.PrimitiveExpression)5 StringConstant (org.evosuite.symbolic.expr.str.StringConstant)4 BigInteger (java.math.BigInteger)3 ArrayList (java.util.ArrayList)3 IntegerConstraint (org.evosuite.symbolic.expr.IntegerConstraint)3 IntegerConstant (org.evosuite.symbolic.expr.bv.IntegerConstant)3 StringBinaryToIntegerExpression (org.evosuite.symbolic.expr.bv.StringBinaryToIntegerExpression)3 StringReaderExpr (org.evosuite.symbolic.expr.reader.StringReaderExpr)3