Skip to content

Commit c98415e

Browse files
authored
Merge pull request #455 from sosy-lab/439-z3-regression-in-string-theory-with-update-to-4140
Reorder test formula in testStringVariableReplaceSubstring() to fix Z3 regression
2 parents 9179057 + 4184316 commit c98415e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/org/sosy_lab/java_smt/test/StringFormulaManagerTest.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,10 +1425,9 @@ public void testStringVariableReplacePrefix() throws SolverException, Interrupte
14251425
public void testStringVariableReplaceSubstring() throws SolverException, InterruptedException {
14261426
requireVariableStringLiterals();
14271427

1428-
assume()
1429-
.withMessage("Regression from Z3 4.13.4 to 4.14.0")
1430-
.that(solverToUse())
1431-
.isNotEqualTo(Solvers.Z3);
1428+
// TODO: Z3 had a regression from Z3 4.13.4 to 4.14.0 in the first implication, running
1429+
// indefinitely. We fixed this by reordering the arguments of the AND expression in the left
1430+
// hand side of the implication. Check if this is persisting after 4.14.0 and possibly report.
14321431

14331432
// I couldn't find stronger constraints in the implication that don't run endlessly.....
14341433
StringFormula original = smgr.makeVariable("original");
@@ -1440,25 +1439,25 @@ public void testStringVariableReplaceSubstring() throws SolverException, Interru
14401439
// comes after the prefix is replaced
14411440
assertThatFormula(
14421441
bmgr.and(
1443-
smgr.prefix(prefix, original),
1444-
imgr.equal(
1445-
smgr.length(prefix),
1446-
smgr.indexOf(
1447-
original,
1448-
smgr.substring(original, smgr.length(prefix), smgr.length(original)),
1449-
imgr.makeNumber(0))),
14501442
imgr.greaterThan(smgr.length(original), smgr.length(prefix)),
14511443
imgr.greaterThan(smgr.length(prefix), imgr.makeNumber(0)),
14521444
imgr.greaterThan(
14531445
smgr.length(
14541446
smgr.substring(original, smgr.length(prefix), smgr.length(original))),
14551447
imgr.makeNumber(0)),
1448+
imgr.equal(
1449+
smgr.length(prefix),
1450+
smgr.indexOf(
1451+
original,
1452+
smgr.substring(original, smgr.length(prefix), smgr.length(original)),
1453+
imgr.makeNumber(0))),
14561454
smgr.equal(
14571455
replaced,
14581456
smgr.replace(
14591457
original,
14601458
smgr.substring(original, smgr.length(prefix), smgr.length(original)),
1461-
replacement))))
1459+
replacement)),
1460+
smgr.prefix(prefix, original)))
14621461
.implies(
14631462
smgr.equal(
14641463
replacement, smgr.substring(replaced, smgr.length(prefix), smgr.length(replaced))));

0 commit comments

Comments
 (0)