use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class S_ValueOf method executeFunction.
@Override
public Object executeFunction() {
IntegerValue int_value = this.getSymbIntegerArgument(0);
ReferenceConstant symb_short = (ReferenceConstant) this.getSymbRetVal();
Short conc_short = (Short) this.getConcRetVal();
env.heap.putField(Types.JAVA_LANG_SHORT, SymbolicHeap.$SHORT_VALUE, conc_short, symb_short, int_value);
return symb_short;
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class D_DoubleValue method executeFunction.
@Override
public Object executeFunction() {
ReferenceConstant symb_double = this.getSymbReceiver();
Double conc_double = (Double) this.getConcReceiver();
double conc_double_value = this.getConcDoubleRetVal();
RealValue symb_int_value = env.heap.getField(Types.JAVA_LANG_DOUBLE, SymbolicHeap.$DOUBLE_VALUE, conc_double, symb_double, conc_double_value);
return symb_int_value;
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class StringBuilder_Init method executeFunction.
@Override
public Object executeFunction() {
// symbolic receiver (new object)
ReferenceConstant symb_str_builder = (ReferenceConstant) this.getSymbReceiver();
// string argument
String conc_str = (String) this.getConcArgument(0);
ReferenceExpression symb_str = this.getSymbArgument(0);
if (symb_str 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);
// update symbolic heap
env.heap.putField(Types.JAVA_LANG_STRING_BUILDER, SymbolicHeap.$STRING_BUILDER_CONTENTS, null, symb_str_builder, strExpr);
}
// return void
return null;
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class Reader_Read method executeFunction.
@Override
public Object executeFunction() {
Reader conc_reader = (Reader) this.getConcReceiver();
if (conc_reader instanceof StringReader) {
ReferenceConstant symb_str_reader = this.getSymbReceiver();
StringReader conc_str_reader = (StringReader) conc_reader;
StringReaderExpr stringReaderExpr = (StringReaderExpr) env.heap.getField(Types.JAVA_IO_STRING_READER, SymbolicHeap.$STRING_READER_VALUE, conc_str_reader, symb_str_reader);
if (stringReaderExpr != null && stringReaderExpr.containsSymbolicVariable()) {
StringValue symb_string = stringReaderExpr.getString();
String conc_string = symb_string.getConcreteValue();
int currPosition = stringReaderExpr.getReaderPosition();
if (currPosition < conc_string.length()) {
// update symbolic string reader
currPosition++;
int conc_string_reader_value;
if (currPosition >= conc_string.length()) {
conc_string_reader_value = -1;
} else {
conc_string_reader_value = conc_string.charAt(currPosition);
}
StringReaderExpr newStringReaderExpr = new StringReaderExpr((long) conc_string_reader_value, symb_string, currPosition);
env.heap.putField(Types.JAVA_IO_STRING_READER, SymbolicHeap.$STRING_READER_VALUE, conc_str_reader, symb_str_reader, newStringReaderExpr);
}
// returns STRING_READER(string,currPosition)
return stringReaderExpr;
}
}
return this.getSymbIntegerRetVal();
}
use of org.evosuite.symbolic.expr.ref.ReferenceConstant in project evosuite by EvoSuite.
the class I_ParseInt method executeFunction.
@Override
public Object executeFunction() {
ReferenceConstant symb_string_ref = (ReferenceConstant) this.getSymbArgument(0);
String conc_string = (String) this.getConcArgument(0);
int conc_integer = this.getConcIntRetVal();
StringValue symb_string_value = env.heap.getField(org.evosuite.symbolic.vm.regex.Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_string, symb_string_ref, conc_string);
long longValue = (long) conc_integer;
StringToIntegerCast parse_int_value = new StringToIntegerCast(symb_string_value, longValue);
return parse_int_value;
}
Aggregations