use of org.evosuite.symbolic.expr.RealConstraint in project evosuite by EvoSuite.
the class TestRealSearch method testEQConstantAfterComma.
@Test
public void testEQConstantAfterComma() {
List<Constraint<?>> constraints = new ArrayList<Constraint<?>>();
constraints.add(new RealConstraint(new RealVariable("test1", 0, -1000000.0, 1000000.0), Comparator.EQ, new RealConstant(0.35082)));
EvoSuiteSolver skr = new EvoSuiteSolver();
Map<String, Object> result;
try {
result = solve(skr, constraints);
assertNotNull(result);
assertNotNull(result.get("test1"));
assertTrue(0.35082 == ((Number) result.get("test1")).doubleValue());
} catch (SolverTimeoutException e) {
fail();
}
}
use of org.evosuite.symbolic.expr.RealConstraint in project evosuite by EvoSuite.
the class TestRealSearch method testGTConstantAfterComma.
@Test
public void testGTConstantAfterComma() {
List<Constraint<?>> constraints = new ArrayList<Constraint<?>>();
constraints.add(new RealConstraint(new RealVariable("test1", 2.0, -1000000.0, 1000000.0), Comparator.GT, new RealConstant(2.35082)));
EvoSuiteSolver skr = new EvoSuiteSolver();
Map<String, Object> result;
try {
result = solve(skr, constraints);
assertNotNull(result);
assertNotNull(result.get("test1"));
assertTrue(2.35082 < ((Number) result.get("test1")).doubleValue());
} catch (SolverTimeoutException e) {
fail();
}
}
use of org.evosuite.symbolic.expr.RealConstraint in project evosuite by EvoSuite.
the class TestRealSearch method testNEVariable.
@Test
public void testNEVariable() {
double var1 = 1.5546;
double var2 = 1.5546;
List<Constraint<?>> constraints = new ArrayList<Constraint<?>>();
constraints.add(new RealConstraint(new RealVariable("test1", var1, -1000000.0, 1000000.0), Comparator.NE, new RealVariable("test2", var2, -1000000.0, 1000000.0)));
EvoSuiteSolver skr = new EvoSuiteSolver();
Map<String, Object> result;
try {
result = solve(skr, constraints);
assertNotNull(result);
if (result.containsKey("test1"))
var1 = ((Number) result.get("test1")).doubleValue();
if (result.containsKey("test2"))
var2 = ((Number) result.get("test2")).doubleValue();
assertTrue(var1 != var2);
} catch (SolverTimeoutException e) {
fail();
}
}
use of org.evosuite.symbolic.expr.RealConstraint in project evosuite by EvoSuite.
the class TestRealSearch method testLTConstantAfterComma.
@Test
public void testLTConstantAfterComma() {
List<Constraint<?>> constraints = new ArrayList<Constraint<?>>();
constraints.add(new RealConstraint(new RealVariable("test1", 2.35086, -1000000.0, 1000000.0), Comparator.LT, new RealConstant(2.35082)));
EvoSuiteSolver skr = new EvoSuiteSolver();
Map<String, Object> result;
try {
result = solve(skr, constraints);
assertNotNull(result);
assertNotNull(result.get("test1"));
assertTrue(2.35082 > ((Number) result.get("test1")).doubleValue());
} catch (SolverTimeoutException e) {
fail();
}
}
use of org.evosuite.symbolic.expr.RealConstraint in project evosuite by EvoSuite.
the class TestRealSearch method testGTConstant.
@Test
public void testGTConstant() {
List<Constraint<?>> constraints = new ArrayList<Constraint<?>>();
constraints.add(new RealConstraint(new RealVariable("test1", 0, -1000000.0, 1000000.0), Comparator.GT, new RealConstant(2.35082)));
EvoSuiteSolver skr = new EvoSuiteSolver();
Map<String, Object> result;
try {
result = solve(skr, constraints);
assertNotNull(result);
assertNotNull(result.get("test1"));
assertTrue(2.35082 < ((Number) result.get("test1")).doubleValue());
} catch (SolverTimeoutException e) {
fail();
}
}
Aggregations