use of org.evosuite.symbolic.solver.avm.StringAVM 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);
}
use of org.evosuite.symbolic.solver.avm.StringAVM in project evosuite by EvoSuite.
the class StringAVMTests method testIssueWithOptional.
@Test
public void testIssueWithOptional() throws SolverTimeoutException {
String name = "addd";
StringVariable var = new StringVariable(name, "");
String format = "a.?c";
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);
}
use of org.evosuite.symbolic.solver.avm.StringAVM in project evosuite by EvoSuite.
the class StringAVMTests method testInsertLeft.
@Test
public void testInsertLeft() throws SolverTimeoutException {
String name = "foo";
String start = "abc";
StringVariable var = new StringVariable(name, start);
String format = "\\d\\d\\d" + start;
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();
assertTrue("Length=" + result.length(), result.length() == 6);
assertTrue(result, result.endsWith(start));
}
use of org.evosuite.symbolic.solver.avm.StringAVM in project evosuite by EvoSuite.
the class StringAVMTests method testInsertRight.
@Test
public void testInsertRight() throws SolverTimeoutException {
String name = "foo";
String start = "abc";
StringVariable var = new StringVariable(name, start);
String format = start + "\\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();
assertTrue("Length=" + result.length(), result.length() == 6);
assertTrue(result, result.startsWith(start));
}
Aggregations