use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class ReplaceAll method executeFunction.
@Override
public Object executeFunction() {
// receiver
ReferenceConstant symb_receiver = this.getSymbReceiver();
String conc_receiver = (String) this.getConcReceiver();
// regex argument
ReferenceExpression symb_regex = this.getSymbArgument(0);
String conc_regex = (String) this.getConcArgument(0);
// replacement argument
ReferenceExpression symb_replacement = this.getSymbArgument(1);
String conc_replacement = (String) this.getConcArgument(1);
// return value
String conc_ret_val = (String) this.getConcRetVal();
ReferenceExpression symb_ret_val = this.getSymbRetVal();
StringValue stringReceiverExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_receiver, symb_receiver, conc_receiver);
if (symb_regex instanceof ReferenceConstant && symb_replacement instanceof ReferenceConstant) {
ReferenceConstant non_null_symb_regex = (ReferenceConstant) symb_regex;
StringValue regexExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_regex, non_null_symb_regex, conc_regex);
ReferenceConstant non_null_symb_replacement = (ReferenceConstant) symb_replacement;
StringValue replacementExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_replacement, non_null_symb_replacement, conc_replacement);
if (symb_ret_val instanceof ReferenceConstant) {
ReferenceConstant non_null_symb_ret_val = (ReferenceConstant) symb_ret_val;
StringMultipleExpression symb_value = new StringMultipleExpression(stringReceiverExpr, Operator.REPLACEALL, regexExpr, new ArrayList<Expression<?>>(Collections.singletonList(replacementExpr)), conc_ret_val);
env.heap.putField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_ret_val, non_null_symb_ret_val, symb_value);
}
}
return symb_ret_val;
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class ToLowerCase 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.TOLOWERCASE, conc_ret_val);
env.heap.putField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_ret_val, symb_ret_val, symb_value);
return this.getSymbRetVal();
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class D_ValueOf method executeFunction.
@Override
public Object executeFunction() {
RealValue real_value = this.getSymbRealArgument(0);
ReferenceConstant symb_double = (ReferenceConstant) this.getSymbRetVal();
Double conc_double = (Double) this.getConcRetVal();
env.heap.putField(Types.JAVA_LANG_DOUBLE, SymbolicHeap.$DOUBLE_VALUE, conc_double, symb_double, real_value);
return symb_double;
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class F_Init method executeFunction.
@Override
public Object executeFunction() {
RealValue fp32 = this.getSymbRealArgument(0);
ReferenceConstant symb_float = this.getSymbReceiver();
env.heap.putField(Types.JAVA_LANG_FLOAT, SymbolicHeap.$FLOAT_VALUE, null, /* conc_float */
symb_float, fp32);
// return void
return null;
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class I_Init method executeFunction.
@Override
public Object executeFunction() {
IntegerValue bv32 = this.getSymbIntegerArgument(0);
ReferenceConstant symb_integer = this.getSymbReceiver();
env.heap.putField(Types.JAVA_LANG_INTEGER, SymbolicHeap.$INT_VALUE, null, /* conc_integer */
symb_integer, bv32);
// return void
return null;
}
Aggregations