use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class DefaultTestCaseConcolicExecutor method execute.
public static Collection<Constraint<?>> execute(DefaultTestCase tc) {
List<BranchCondition> pc = getPathCondition(tc);
Collection<Constraint<?>> constraints = new LinkedList<Constraint<?>>();
for (BranchCondition condition : pc) {
constraints.addAll(condition.getSupportingConstraints());
Constraint<?> constraint = condition.getConstraint();
constraints.add(constraint);
}
return constraints;
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverFloats method testExp.
public static void testExp(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestCaseExp();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
assertNotNull(solution);
Double var0 = (Double) solution.get("var0");
Double var1 = (Double) solution.get("var1");
assertEquals(var0.doubleValue(), Math.exp(var1.doubleValue()), DELTA);
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverFloats method testRound.
public static void testRound(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestCaseRound();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
assertNotNull(solution);
Integer var0 = (Integer) solution.get("var0");
Double var1 = (Double) solution.get("var1");
assertEquals(var0.intValue(), Math.round(var1.doubleValue()));
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverFloats method testAtan2.
public static void testAtan2(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestCaseAtan2();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
assertNotNull(solution);
Double var0 = (Double) solution.get("var0");
Double var1 = (Double) solution.get("var1");
Double var2 = (Double) solution.get("var2");
assertEquals(var0.doubleValue(), Math.atan2(var1.doubleValue(), var2.doubleValue()), DELTA);
}
use of org.evosuite.symbolic.expr.Constraint in project evosuite by EvoSuite.
the class TestSolverFloats method testDiv.
public static void testDiv(Solver solver) throws SecurityException, NoSuchMethodException, SolverTimeoutException {
DefaultTestCase tc = buildTestCaseFloatDiv();
Collection<Constraint<?>> constraints = DefaultTestCaseConcolicExecutor.execute(tc);
Map<String, Object> solution = solve(solver, constraints);
assertNotNull(solution);
Double var0 = (Double) solution.get("var0");
Double var1 = (Double) solution.get("var1");
assertTrue(var0.doubleValue() == var1.doubleValue() / 2.0);
}
Aggregations