use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class StringBuilder_ToString method executeFunction.
@Override
public Object executeFunction() {
ReferenceConstant symb_str_builder = (ReferenceConstant) this.getSymbReceiver();
// receiver
StringBuilder conc_str_builder = (StringBuilder) this.getConcReceiver();
// return value
String res = (String) this.getConcRetVal();
if (res != null) {
ReferenceConstant symb_ret_val = (ReferenceConstant) this.getSymbRetVal();
StringValue symb_value = env.heap.getField(Types.JAVA_LANG_STRING_BUILDER, SymbolicHeap.$STRING_BUILDER_CONTENTS, conc_str_builder, symb_str_builder, conc_str_builder.toString());
String conc_receiver = (String) res;
env.heap.putField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_receiver, symb_ret_val, symb_value);
}
return this.getSymbRetVal();
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class HasMoreTokens method executeFunction.
@Override
public Object executeFunction() {
StringTokenizer conc_tokenizer = (StringTokenizer) this.getConcReceiver();
ReferenceConstant symb_tokenizer = this.getSymbReceiver();
boolean res = this.getConcBooleanRetVal();
TokenizerExpr tokenizerExpr = (TokenizerExpr) env.heap.getField(Types.JAVA_UTIL_STRING_TOKENIZER, SymbolicHeap.$STRING_TOKENIZER_VALUE, conc_tokenizer, symb_tokenizer);
if (tokenizerExpr != null && tokenizerExpr.containsSymbolicVariable()) {
HasMoreTokensExpr hasMoreTokenExpr = new HasMoreTokensExpr(tokenizerExpr, (long) (res ? 1L : 0L));
return hasMoreTokenExpr;
}
return this.getSymbIntegerRetVal();
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class StringTokenizer_Init method executeFunction.
@Override
public Object executeFunction() {
// symbolic receiver (new object)
ReferenceConstant symb_str_tokenizer = (ReferenceConstant) this.getSymbReceiver();
// string argument
String conc_str = (String) this.getConcArgument(0);
ReferenceExpression symb_str = this.getSymbArgument(0);
// delim argument
String conc_delim = (String) this.getConcArgument(1);
ReferenceExpression symb_delim = this.getSymbArgument(1);
if (symb_str instanceof ReferenceConstant && symb_delim instanceof ReferenceConstant) {
ReferenceConstant non_null_symb_string = (ReferenceConstant) symb_str;
assert conc_str != null;
StringValue strExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_str, non_null_symb_string, conc_str);
ReferenceConstant non_null_symb_delim = (ReferenceConstant) symb_delim;
assert conc_delim != null;
StringValue delimExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_delim, non_null_symb_delim, conc_delim);
NewTokenizerExpr newTokenizerExpr = new NewTokenizerExpr(strExpr, delimExpr);
// update symbolic heap
env.heap.putField(Types.JAVA_UTIL_STRING_TOKENIZER, SymbolicHeap.$STRING_TOKENIZER_VALUE, null, symb_str_tokenizer, newTokenizerExpr);
}
// constructor returns void
return null;
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class B_Init method executeFunction.
@Override
public Object executeFunction() {
IntegerValue bv32 = this.getSymbIntegerArgument(0);
ReferenceConstant symb_byte = (ReferenceConstant) this.getSymbReceiver();
env.heap.putField(Types.JAVA_LANG_BYTE, SymbolicHeap.$BYTE_VALUE, null, /* conc_integer */
symb_byte, bv32);
// return void
return null;
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class C_CharValue method executeFunction.
@Override
public Object executeFunction() {
ReferenceConstant symb_character = this.getSymbReceiver();
Character conc_character = (Character) this.getConcReceiver();
char conc_char_value = this.getConcCharRetVal();
IntegerValue symb_char_value = env.heap.getField(Types.JAVA_LANG_CHARACTER, SymbolicHeap.$CHAR_VALUE, conc_character, symb_character, conc_char_value);
return symb_char_value;
}
Aggregations