use of org.evosuite.symbolic.expr.bv.StringUnaryToIntegerExpression in project evosuite by EvoSuite.
the class TestStringSearch3 method testCharAt.
// (var3("<V6h") charAt 0) >= 0,
// (var3("<V6h").length() - 1) >= 0,
// (var3("<V6h") charAt 0) == 10]
@Test
public void testCharAt() {
StringVariable var3 = new StringVariable("var3", "<\n V6h");
StringBinaryToIntegerExpression var3_charAt_0 = new StringBinaryToIntegerExpression(var3, Operator.CHARAT, new IntegerConstant(0), (long) "<\n V6h".charAt(0));
IntegerConstraint cnstr1 = new IntegerConstraint(var3_charAt_0, Comparator.GE, new IntegerConstant(0));
StringUnaryToIntegerExpression var3_length = new StringUnaryToIntegerExpression(var3, Operator.LENGTH, (long) "<\n V6h".length());
IntegerBinaryExpression length_minus_one = new IntegerBinaryExpression(var3_length, Operator.MINUS, new IntegerConstant(1), (long) "<\n V6h".length() - 1);
IntegerConstraint cnstr2 = new IntegerConstraint(length_minus_one, Comparator.GE, new IntegerConstant(0));
IntegerConstraint cnstr3 = new IntegerConstraint(var3_charAt_0, Comparator.EQ, new IntegerConstant(10));
ArrayList<Constraint<?>> constraints = new ArrayList<Constraint<?>>();
constraints.add(cnstr1);
constraints.add(cnstr2);
constraints.add(cnstr3);
EvoSuiteSolver solver = new EvoSuiteSolver();
Map<String, Object> solution;
try {
solution = solve(solver, constraints);
assertNotNull(solution);
} catch (SolverTimeoutException e) {
fail();
}
}
Aggregations