use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class StringBuffer_SetLength method executeFunction.
@Override
public Object executeFunction() {
ReferenceConstant symb_str_buffer = this.getSymbReceiver();
StringBuffer conc_str_buffer = (StringBuffer) this.getConcReceiver();
IntegerValue newSymbLength = this.getSymbIntegerArgument(0);
int newConcLength = this.getConcIntArgument(0);
// retrieve symbolic value from heap
String conc_value = conc_str_buffer.toString();
StringValue symb_value = env.heap.getField(Types.JAVA_LANG_STRING_BUFFER, SymbolicHeap.$STRING_BUFFER_CONTENTS, conc_str_buffer, symb_str_buffer, pre_conc_value);
if (symb_value.containsSymbolicVariable() || newSymbLength.containsSymbolicVariable()) {
StringValue new_symb_value = null;
if (!newSymbLength.containsSymbolicVariable() && newConcLength == 0) {
// StringBuffer contents equals to "" string
new_symb_value = new StringConstant("");
} else {
// StringBuffer contents equ
new_symb_value = new StringMultipleExpression(symb_value, Operator.SUBSTRING, new IntegerConstant(0), new ArrayList<Expression<?>>(Collections.singletonList(newSymbLength)), conc_value);
}
env.heap.putField(Types.JAVA_LANG_STRING_BUFFER, SymbolicHeap.$STRING_BUFFER_CONTENTS, conc_str_buffer, symb_str_buffer, new_symb_value);
}
// return void
return null;
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class BigInteger_IntValue method executeFunction.
@Override
public Object executeFunction() {
BigInteger conc_big_integer = (BigInteger) this.getConcReceiver();
ReferenceConstant symb_big_integer = this.getSymbReceiver();
int res = this.getConcIntRetVal();
IntegerValue integer_expr = this.env.heap.getField(Types.JAVA_MATH_BIG_INTEGER, SymbolicHeap.$BIG_INTEGER_CONTENTS, conc_big_integer, symb_big_integer, res);
return integer_expr;
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class RegionMatches method executeFunction.
@Override
public Object executeFunction() {
ReferenceConstant symb_receiver = (ReferenceConstant) this.getSymbReceiver();
String conc_receiver = (String) this.getConcReceiver();
StringValue stringReceiverExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_receiver, symb_receiver, conc_receiver);
IntegerValue ignoreCaseExpr = this.getSymbIntegerArgument(0);
IntegerValue toffsetExpr = this.getSymbIntegerArgument(1);
ReferenceConstant symb_other = (ReferenceConstant) this.getSymbArgument(2);
String conc_other = (String) this.getConcArgument(2);
StringValue otherExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_other, symb_other, conc_other);
IntegerValue ooffsetExpr = this.getSymbIntegerArgument(3);
IntegerValue lenExpr = this.getSymbIntegerArgument(4);
boolean res = this.getConcBooleanRetVal();
if (stringReceiverExpr.containsSymbolicVariable() || ignoreCaseExpr.containsSymbolicVariable() || toffsetExpr.containsSymbolicVariable() || otherExpr.containsSymbolicVariable() || ooffsetExpr.containsSymbolicVariable() || lenExpr.containsSymbolicVariable()) {
ArrayList<Expression<?>> other = new ArrayList<Expression<?>>();
other.add(toffsetExpr);
other.add(ooffsetExpr);
other.add(lenExpr);
other.add(ignoreCaseExpr);
int conV = res ? 1 : 0;
StringMultipleComparison strComp = new StringMultipleComparison(stringReceiverExpr, Operator.REGIONMATCHES, otherExpr, other, (long) conV);
return strComp;
}
return this.getSymbIntegerRetVal();
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class LocalsVM method LSTORE.
@Override
public void LSTORE(int i) {
IntegerValue integerExpr = env.topFrame().operandStack.popBv64();
env.topFrame().localsTable.setBv64Local(i, integerExpr);
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class LocalsVM method ISTORE.
/**
* ..., value ==> ...
*
* http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
* doc6.html#istore
*/
@Override
public void ISTORE(int i) {
IntegerValue integerExpr = env.topFrame().operandStack.popBv32();
env.topFrame().localsTable.setBv32Local(i, integerExpr);
}
Aggregations