use of org.evosuite.symbolic.expr.str.StringUnaryExpression in project evosuite by EvoSuite.
the class ToUpperCase 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.TOUPPERCASE, 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.str.StringUnaryExpression 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.str.StringUnaryExpression in project evosuite by EvoSuite.
the class Trim 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.TRIM, 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.str.StringUnaryExpression in project evosuite by EvoSuite.
the class TestStringSearch method testEqualsToLowerCase.
@Test
public void testEqualsToLowerCase() {
// (wed equals var1("f|").toLowerCase()) != 0
StringVariable var1 = new StringVariable("var1", "f|");
StringBinaryComparison cmp3 = new StringBinaryComparison(new StringConstant("wed"), Operator.EQUALS, new StringUnaryExpression(var1, Operator.TOLOWERCASE, "f|".toLowerCase()), 0L);
StringConstraint constr3 = new StringConstraint(cmp3, Comparator.NE, new IntegerConstant(0));
Collection<Constraint<?>> constraints = new ArrayList<Constraint<?>>();
constraints.add(constr3);
EvoSuiteSolver solver = new EvoSuiteSolver();
Map<String, Object> solution;
try {
solution = solve(solver, constraints);
assertNotNull(solution);
} catch (SolverTimeoutException e) {
fail();
}
}
Aggregations