use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverStringFunctions method testStringLastIndexOfChar.
public static Map<String, Object> testStringLastIndexOfChar(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestLastIndexOfChar();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
return solution;
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverStringFunctions method testStringUpperCase.
public static Map<String, Object> testStringUpperCase(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestUpperCase();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
return solution;
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverUNSAT method testUNSAT.
public static void testUNSAT(Solver solver) throws SolverTimeoutException, IOException, SolverParseException, SolverEmptyQueryException, SolverErrorException {
Collection<Constraint<?>> constraints = new LinkedList<Constraint<?>>();
IntegerVariable x = new IntegerVariable("x", 1L, Long.MIN_VALUE, Long.MAX_VALUE);
IntegerConstraint unsat_constraint = ConstraintFactory.neq(x, x);
constraints.add(unsat_constraint);
SolverResult result = solver.solve(constraints);
assertTrue(result.isUNSAT());
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestConstraintSolver3 method buildConstraintSystem.
private static Collection<Constraint<?>> buildConstraintSystem() {
StringVariable var0 = new StringVariable("var0", INIT_STRING);
StringToIntegerCast castStr = new StringToIntegerCast(var0, (long) Integer.parseInt(INIT_STRING));
IntegerConstant const126 = new IntegerConstant(EXPECTED_INTEGER);
IntegerConstraint constr1 = new IntegerConstraint(castStr, Comparator.EQ, const126);
return Arrays.<Constraint<?>>asList(constr1);
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestIsInteger method testIsInteger.
@Test
public void testIsInteger() throws SolverEmptyQueryException {
List<Constraint<?>> constraints = new ArrayList<Constraint<?>>();
constraints.add(new IntegerConstraint(new StringUnaryToIntegerExpression(new StringVariable("var0", "hello"), Operator.IS_INTEGER, 0L), Comparator.NE, new IntegerConstant(0)));
EvoSuiteSolver solver = new EvoSuiteSolver();
try {
SolverResult result = solver.solve(constraints);
assertTrue(result.isSAT());
} catch (SolverTimeoutException e) {
fail();
}
}
Aggregations