use of org.sosy_lab.java_smt.api.RegexFormula in project java-smt by sosy-lab.
the class SolverVisitorTest method stringInBooleanFormulaIdVisit.
@Test
public void stringInBooleanFormulaIdVisit() throws SolverException, InterruptedException {
requireStrings();
StringFormula x = smgr.makeVariable("xVariable");
StringFormula y = smgr.makeVariable("yVariable");
RegexFormula r = smgr.makeRegex("regex1");
for (BooleanFormula f : ImmutableList.of(smgr.equal(x, y), smgr.contains(x, y), smgr.lessThan(x, y), smgr.lessOrEquals(x, y), smgr.greaterOrEquals(x, y), smgr.greaterThan(x, y), smgr.prefix(x, y), smgr.suffix(x, y), smgr.in(x, r))) {
mgr.visit(f, new FunctionDeclarationVisitorNoUF());
mgr.visit(f, new FunctionDeclarationVisitorNoOther());
BooleanFormula f2 = mgr.transformRecursively(f, new FormulaTransformationVisitor(mgr) {
});
assertThat(f2).isEqualTo(f);
assertThatFormula(f).isEquivalentTo(f2);
}
}
use of org.sosy_lab.java_smt.api.RegexFormula in project java-smt by sosy-lab.
the class StringFormulaManagerTest method testRegexAll.
// Tests
@Test
public void testRegexAll() throws SolverException, InterruptedException {
RegexFormula regex = smgr.all();
assertThatFormula(smgr.in(hello, regex)).isSatisfiable();
}
use of org.sosy_lab.java_smt.api.RegexFormula in project java-smt by sosy-lab.
the class StringFormulaManagerTest method testStringRegex2.
@Test
public void testStringRegex2() throws SolverException, InterruptedException {
RegexFormula regex = smgr.concat(smgr.closure(a2z), smgr.makeRegex("ll"), smgr.closure(a2z));
assertThatFormula(smgr.in(hello, regex)).isSatisfiable();
}
use of org.sosy_lab.java_smt.api.RegexFormula in project java-smt by sosy-lab.
the class SolverVisitorTest method stringInRegexFormulaVisit.
@Test
public void stringInRegexFormulaVisit() {
requireStrings();
RegexFormula r = smgr.makeRegex("regex1");
RegexFormula s = smgr.makeRegex("regex2");
ImmutableList.Builder<RegexFormula> formulas = ImmutableList.<RegexFormula>builder().add(smgr.union(r, s)).add(smgr.closure(r)).add(smgr.concat(r, r, r, s, s, s)).add(smgr.cross(r));
if (solverToUse() != Solvers.Z3) {
formulas.add(smgr.difference(r, s)).add(smgr.complement(r));
// invalid function OTHER/INTERNAL in visitor, bug in Z3?
}
for (RegexFormula f : formulas.build()) {
mgr.visit(f, new FunctionDeclarationVisitorNoUF());
mgr.visit(f, new FunctionDeclarationVisitorNoOther());
RegexFormula f2 = mgr.transformRecursively(f, new FormulaTransformationVisitor(mgr) {
});
assertThat(f2).isEqualTo(f);
}
}
use of org.sosy_lab.java_smt.api.RegexFormula in project java-smt by sosy-lab.
the class StringFormulaManagerTest method testStringRegex3.
@Test
public void testStringRegex3() throws SolverException, InterruptedException {
RegexFormula regex = smgr.makeRegex(".*ll.*");
assertThatFormula(smgr.in(hello, regex)).isUnsatisfiable();
}
Aggregations