Search in sources :

Example 1 with StringBinaryExpression

use of org.evosuite.symbolic.expr.str.StringBinaryExpression in project evosuite by EvoSuite.

the class Concat method executeFunction.

@Override
public Object executeFunction() {
    String conc_left = (String) this.getConcReceiver();
    ReferenceConstant symb_left = this.getSymbReceiver();
    StringValue left_expr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_left, symb_left, conc_left);
    String conc_right = (String) this.getConcArgument(0);
    ReferenceConstant symb_right = (ReferenceConstant) this.getSymbArgument(0);
    StringValue right_expr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_right, symb_right, conc_right);
    String res = (String) this.getConcRetVal();
    if (res != null) {
        StringBinaryExpression symb_value = new StringBinaryExpression(left_expr, Operator.CONCAT, right_expr, (String) res);
        ReferenceConstant symb_receiver = (ReferenceConstant) env.topFrame().operandStack.peekRef();
        String conc_receiver = (String) res;
        env.heap.putField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_receiver, symb_receiver, symb_value);
    }
    return this.getSymbRetVal();
}
Also used : ReferenceConstant(org.evosuite.symbolic.expr.ref.ReferenceConstant) StringBinaryExpression(org.evosuite.symbolic.expr.str.StringBinaryExpression) StringValue(org.evosuite.symbolic.expr.str.StringValue)

Aggregations

ReferenceConstant (org.evosuite.symbolic.expr.ref.ReferenceConstant)1 StringBinaryExpression (org.evosuite.symbolic.expr.str.StringBinaryExpression)1 StringValue (org.evosuite.symbolic.expr.str.StringValue)1