use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverSimpleMath method testCastIntToReal.
public static void testCastIntToReal(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestCaseCastIntToReal();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
assertNotNull(solution);
Long var0 = (Long) solution.get("var0");
assertEquals(var0.intValue(), (int) var0.doubleValue());
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverSimpleMath method testMul.
public static void testMul(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestCaseMul();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
assertNotNull(solution);
Long var0 = (Long) solution.get("var0");
Long var1 = (Long) solution.get("var1");
assertTrue(var0.intValue() != 0);
assertEquals(var1.intValue(), var0.intValue() * 2);
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverSimpleMath method testEq.
public static void testEq(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestCaseEq();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
assertNotNull(solution);
Long var0 = (Long) solution.get("var0");
Long var1 = (Long) solution.get("var1");
assertEquals(var0.intValue(), var1.intValue());
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverSimpleMath method testLte.
public static void testLte(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestCaseLte();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
assertNotNull(solution);
Long var0 = (Long) solution.get("var0");
Long var1 = (Long) solution.get("var1");
assertTrue(var0.intValue() <= var1.intValue());
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class StringAVMTests method testSimpleRegexThreeDigits.
@Test
public void testSimpleRegexThreeDigits() throws SolverTimeoutException {
String name = "foo";
StringVariable var = new StringVariable(name, "");
String format = "\\d\\d\\d";
List<Constraint<?>> constraints = getPatternConstraint(var, format);
long start_time = System.currentTimeMillis();
long timeout = Properties.DSE_CONSTRAINT_SOLVER_TIMEOUT_MILLIS;
StringAVM avm = new StringAVM(var, constraints, start_time, timeout);
boolean succeded = avm.applyAVM();
assertTrue(succeded);
String result = var.getConcreteValue();
Integer value = Integer.parseInt(result);
assertTrue("Value=" + result, value >= 0 && value <= 999);
}
Aggregations