use of org.evosuite.symbolic.expr.Expression in project evosuite by EvoSuite.
the class SymbolicHeap method array_load.
public StringValue array_load(ReferenceExpression symb_array, int conc_index, String conc_value) {
Map<Integer, Expression<?>> symb_array_contents = getOrCreateSymbolicArray(symb_array);
StringValue symb_value = (StringValue) symb_array_contents.get(conc_index);
if (symb_value == null || !((String) symb_value.getConcreteValue()).equals(conc_value)) {
symb_value = ExpressionFactory.buildNewStringConstant(conc_value);
symb_array_contents.remove(conc_index);
}
return symb_value;
}
use of org.evosuite.symbolic.expr.Expression in project evosuite by EvoSuite.
the class SymbolicHeap method array_load.
public RealValue array_load(ReferenceExpression symb_array, int conc_index, double conc_value) {
Map<Integer, Expression<?>> symb_array_contents = getOrCreateSymbolicArray(symb_array);
RealValue symb_value = (RealValue) symb_array_contents.get(conc_index);
if (symb_value == null || ((Double) symb_value.getConcreteValue()).doubleValue() != conc_value) {
symb_value = ExpressionFactory.buildNewRealConstant(conc_value);
symb_array_contents.remove(conc_index);
}
return symb_value;
}
use of org.evosuite.symbolic.expr.Expression in project evosuite by EvoSuite.
the class SymbolicHeap method getField.
/**
* @param className
* @param fieldName
* @param conc_receiver
* @param symb_receiver
* @param conc_value
* @return
*/
public RealValue getField(String className, String fieldName, Object conc_receiver, ReferenceExpression symb_receiver, double conc_value) {
Map<ReferenceExpression, Expression<?>> symb_field = getOrCreateSymbolicField(className, fieldName);
RealValue symb_value = (RealValue) symb_field.get(symb_receiver);
if (symb_value == null || ((Double) symb_value.getConcreteValue()).doubleValue() != conc_value) {
symb_value = ExpressionFactory.buildNewRealConstant(conc_value);
symb_field.remove(symb_receiver);
}
return symb_value;
}
use of org.evosuite.symbolic.expr.Expression in project evosuite by EvoSuite.
the class RegionMatches5 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 = new IntegerConstant(0);
IntegerValue toffsetExpr = this.getSymbIntegerArgument(0);
ReferenceConstant symb_other = (ReferenceConstant) this.getSymbArgument(1);
String conc_other = (String) this.getConcArgument(1);
StringValue otherExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_other, symb_other, conc_other);
IntegerValue ooffsetExpr = this.getSymbIntegerArgument(2);
IntegerValue lenExpr = this.getSymbIntegerArgument(3);
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.Expression 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();
}
Aggregations