Skip to content

Commit fa89068

Browse files
daniel-rafflerkfriedberger
authored andcommitted
Tests: Enable tests that were previously disabled, but are now running fine
1 parent 92f754b commit fa89068

18 files changed

+58
-214
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,12 @@ public void testDisjunctionArgsExtractionRecursive()
269269

270270
@Test
271271
public void simplificationTest() {
272-
// Boolector and CVC5 fail this as it either simplifies to much, or nothing
273-
// TODO: maybe this is just a matter of options, check!
272+
// Boolector fail this as it either simplifies to much, or nothing
274273
assume()
275274
.withMessage(
276275
"Solver %s fails on this test as it does not simplify any formulas.", solverToUse())
277276
.that(solverToUse())
278-
.isNoneOf(Solvers.BOOLECTOR, Solvers.CVC5);
277+
.isNotEqualTo(Solvers.BOOLECTOR);
279278

280279
BooleanFormula tru = bmgr.makeBoolean(true);
281280
BooleanFormula fals = bmgr.makeBoolean(false);

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,15 +1082,12 @@ private List<Float> getListOfFloats() {
10821082
Float.POSITIVE_INFINITY,
10831083
Float.NEGATIVE_INFINITY,
10841084
0.0f,
1085+
-0.0f,
10851086
1f,
10861087
-1f,
10871088
2f,
10881089
-2f);
10891090

1090-
if (solverToUse() != Solvers.MATHSAT5) {
1091-
flts.add(-0.0f); // MathSat5 fails for NEGATIVE_ZERO
1092-
}
1093-
10941091
for (int i = 1; i < 10; i++) {
10951092
for (int j = 1; j < 10; j++) {
10961093
flts.add((float) (i * Math.pow(10, j)));
@@ -1119,15 +1116,12 @@ private List<Double> getListOfDoubles() {
11191116
Double.POSITIVE_INFINITY,
11201117
Double.NEGATIVE_INFINITY,
11211118
0.0,
1119+
-0.0,
11221120
1d,
11231121
-1d,
11241122
2d,
11251123
-2d);
11261124

1127-
if (solverToUse() != Solvers.MATHSAT5) {
1128-
dbls.add(-0.0); // MathSat5 fails for NEGATIVE_ZERO
1129-
}
1130-
11311125
for (int i = 1; i < 10; i++) {
11321126
for (int j = 1; j < 10; j++) {
11331127
dbls.add(i * Math.pow(10, j));

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ public void test_ABVIRA() {
165165
requireBitvectors();
166166
requireIntegers();
167167
requireRationals();
168-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
169168
String query =
170169
NUMERAL_VARS
171170
+ BV_VARS
@@ -180,7 +179,6 @@ public void test_ABV() {
180179
requireArrays();
181180
requireQuantifiers();
182181
requireBitvectors();
183-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
184182
String query =
185183
BOOL_VARS
186184
+ BV_VARS
@@ -195,7 +193,6 @@ public void test_QF_AUFBV() {
195193
requireParser();
196194
requireArrays();
197195
requireBitvectors();
198-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
199196
String query = BV_VARS + "(assert (and (= bv bv2) (= bvarr bvarr2) (= (bvfoo bv) bv2)" + "))";
200197
classifier.visit(mgr.parse(query));
201198
assertThat(classifier.toString()).isEqualTo("QF_AUFBV");
@@ -205,7 +202,8 @@ public void test_QF_AUFBV() {
205202
public void test_QF_BV() {
206203
requireParser();
207204
requireBitvectors();
208-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
205+
// Princess rewrites the formula and replaces the bitvector constant with an integer term
206+
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS);
209207
String query = BV_VARS + "(assert (bvult bv (bvadd bv #x1)))";
210208
classifier.visit(mgr.parse(query));
211209
assertThat(classifier.toString()).isEqualTo("QF_BV");
@@ -236,7 +234,6 @@ public void test_QF_NIA() {
236234
requireIntegers();
237235
requireNonlinear();
238236
String query = NUMERAL_VARS + "(assert (< xx (* x x)))";
239-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
240237
classifier.visit(mgr.parse(query));
241238
assertThat(classifier.toString()).isEqualTo("QF_NIA");
242239
}
@@ -258,7 +255,6 @@ public void test_QF_UFLIRA() {
258255
requireIntegers();
259256
requireRationals(); // NUMERAL_VARS includes REALs
260257
String query = NUMERAL_VARS + "(assert (= (foo x) x))";
261-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
262258
classifier.visit(mgr.parse(query));
263259
assertThat(classifier.toString()).isEqualTo("QF_UF");
264260
}
@@ -271,11 +267,11 @@ public void test_QF_UF() {
271267
.withMessage("MathSAT does not support functions with Bool arguments")
272268
.that(solverToUse())
273269
.isNotEqualTo(Solvers.MATHSAT5);
274-
classifier.visit(mgr.parse(query));
275270
assume()
271+
.withMessage("Princess will rewrite UFs with boolean arguments")
276272
.that(solverToUse())
277-
.isNotEqualTo(Solvers.PRINCESS); // Princess classifies it as QF_UFLIA
278-
// TODO: see why Princess classifies this wrongly
273+
.isNotEqualTo(Solvers.PRINCESS);
274+
classifier.visit(mgr.parse(query));
279275
assertThat(classifier.toString()).isEqualTo("QF_UF");
280276
}
281277

@@ -285,7 +281,6 @@ public void test_QF_UFBVLIRA() {
285281
requireBitvectors();
286282
requireRationals();
287283
requireIntegers();
288-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
289284
String query = NUMERAL_VARS + BV_VARS + "(assert (and (= bv bv2) (= (foo x) x)))";
290285
classifier.visit(mgr.parse(query));
291286
assertThat(classifier.toString()).isEqualTo("QF_UFBV");
@@ -295,7 +290,6 @@ public void test_QF_UFBVLIRA() {
295290
public void test_QF_UFBV() {
296291
requireParser();
297292
requireBitvectors();
298-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
299293
String query = BV_VARS + "(assert (and (= bv bv2) (= (bvfoo bv) bv2)))";
300294
classifier.visit(mgr.parse(query));
301295
assertThat(classifier.toString()).isEqualTo("QF_UFBV");
@@ -307,7 +301,6 @@ public void test_QF_UFLIRA2() {
307301
requireIntegers();
308302
requireRationals(); // NUMERAL_VARS includes REALs
309303
String query = NUMERAL_VARS + "(assert (< xx (+ x (foo x))))";
310-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
311304
classifier.visit(mgr.parse(query));
312305
assertThat(classifier.toString()).isEqualTo("QF_UFLIA");
313306
}
@@ -349,7 +342,7 @@ public void test_UFNRA() {
349342
requireParser();
350343
requireRationals();
351344
requireNonlinear();
352-
requireQuantifiers(); // TODO SMTInterpol fails when parsing this
345+
requireQuantifiers();
353346
String query = NUMERAL_VARS + "(assert (exists ((zz Real)) (< (* y yy) (bar y))))";
354347
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS); // Princess rewrites the formula
355348
classifier.visit(mgr.parse(query));

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public class FormulaManagerTest extends SolverBasedTest0.ParameterizedSolverBase
3535
public void testEmptySubstitution() throws SolverException, InterruptedException {
3636
requireSubstitution();
3737
requireIntegers();
38-
assume().withMessage("Princess fails").that(solver).isNotEqualTo(Solvers.PRINCESS);
3938

4039
IntegerFormula variable1 = imgr.makeVariable("variable1");
4140
IntegerFormula variable2 = imgr.makeVariable("variable2");
@@ -56,7 +55,6 @@ public void testEmptySubstitution() throws SolverException, InterruptedException
5655
public void testNoSubstitution() throws SolverException, InterruptedException {
5756
requireSubstitution();
5857
requireIntegers();
59-
assume().withMessage("Princess fails").that(solver).isNotEqualTo(Solvers.PRINCESS);
6058

6159
IntegerFormula variable1 = imgr.makeVariable("variable1");
6260
IntegerFormula variable2 = imgr.makeVariable("variable2");

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,6 @@ public <T> void binaryInterpolationWithConstantFalse()
199199
public <T> void binaryBVInterpolation1() throws SolverException, InterruptedException {
200200
requireBitvectors();
201201

202-
assume()
203-
.withMessage("Solver %s runs into timeout on this test", solverToUse())
204-
.that(solverToUse())
205-
.isNotEqualTo(Solvers.CVC5);
206-
207202
InterpolatingProverEnvironment<T> stack = newEnvironmentForTest();
208203

209204
int i = index.getFreshId();

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ public void testGetArrays3() throws SolverException, InterruptedException {
11551155
assume()
11561156
.withMessage("As of now, only Princess does not support multi-dimensional arrays")
11571157
.that(solver)
1158-
.isNotSameInstanceAs(Solvers.PRINCESS);
1158+
.isNotEqualTo(Solvers.PRINCESS);
11591159

11601160
// create formula for "arr[5][3][1]==x && x==123"
11611161
BooleanFormula f =
@@ -1741,12 +1741,7 @@ private void checkModelAssignmentsValid(
17411741
public void ufTest() throws SolverException, InterruptedException {
17421742
requireQuantifiers();
17431743
requireBitvectors();
1744-
// only Z3 fulfills these requirements
1745-
1746-
assume()
1747-
.withMessage("solver does not implement optimisation")
1748-
.that(solverToUse())
1749-
.isEqualTo(Solvers.Z3);
1744+
requireOptimization();
17501745

17511746
BitvectorType t32 = FormulaType.getBitvectorTypeWithSize(32);
17521747
FunctionDeclaration<BitvectorFormula> si1 = fmgr.declareUF("*signed_int@1", t32, t32);

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

Lines changed: 5 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,6 @@ private SolverException handleSolverException(SolverException e) throws SolverEx
117117

118118
@Test
119119
public void testLIAForallArrayConjunctUnsat() throws SolverException, InterruptedException {
120-
assume()
121-
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
122-
.that(solverToUse())
123-
.isNotEqualTo(Solvers.CVC5);
124-
125120
// (forall x . b[x] = 0) AND (b[123] = 1) is UNSAT
126121
setUpLIA();
127122

@@ -134,15 +129,8 @@ public void testLIAForallArrayConjunctUnsat() throws SolverException, Interrupte
134129

135130
@Test
136131
public void testBVForallArrayConjunctUnsat() throws SolverException, InterruptedException {
137-
assume()
138-
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
139-
.that(solverToUse())
140-
.isNotEqualTo(Solvers.CVC5);
141-
142132
// (forall x . b[x] = 0) AND (b[123] = 1) is UNSAT
143133
setUpBV();
144-
// Princess does not support bitvectors in arrays
145-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS);
146134

147135
BooleanFormula f =
148136
bmgr.and(
@@ -184,8 +172,6 @@ public void testBVForallArrayConjunctSat() throws SolverException, InterruptedEx
184172

185173
// (forall x . b[x] = 0) AND (b[123] = 0) is SAT
186174
setUpBV();
187-
// Princess does not support bitvectors in arrays
188-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS);
189175

190176
BooleanFormula f =
191177
bmgr.and(
@@ -246,11 +232,6 @@ public void testLIAForallArrayDisjunctSat2() throws SolverException, Interrupted
246232

247233
@Test
248234
public void testLIANotExistsArrayConjunct1() throws SolverException, InterruptedException {
249-
assume()
250-
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
251-
.that(solverToUse())
252-
.isNotEqualTo(Solvers.CVC5);
253-
254235
// (not exists x . not b[x] = 0) AND (b[123] = 1) is UNSAT
255236
setUpLIA();
256237
BooleanFormula f =
@@ -286,11 +267,6 @@ public void testLIANotExistsArrayConjunct2() throws SolverException, Interrupted
286267

287268
@Test
288269
public void testLIANotExistsArrayConjunct3() throws SolverException, InterruptedException {
289-
assume()
290-
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
291-
.that(solverToUse())
292-
.isNotEqualTo(Solvers.CVC5);
293-
294270
// (not exists x . b[x] = 0) AND (b[123] = 0) is UNSAT
295271
setUpLIA();
296272
BooleanFormula f =
@@ -358,8 +334,6 @@ public void testLIAExistsArrayConjunct1() throws SolverException, InterruptedExc
358334
public void testBVExistsArrayConjunct1() throws SolverException, InterruptedException {
359335
// (exists x . b[x] = 0) AND (b[123] = 1) is SAT
360336
setUpBV();
361-
// Princess does not support bitvectors in arrays
362-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS);
363337

364338
BooleanFormula f =
365339
bmgr.and(
@@ -373,11 +347,6 @@ public void testBVExistsArrayConjunct1() throws SolverException, InterruptedExce
373347
@Test
374348
public void testLIAExistsArrayConjunct2() throws SolverException, InterruptedException {
375349
setUpLIA();
376-
assume()
377-
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
378-
.that(solverToUse())
379-
.isNotEqualTo(Solvers.CVC5);
380-
381350
// (exists x . b[x] = 1) AND (forall x . b[x] = 0) is UNSAT
382351

383352
BooleanFormula f =
@@ -387,15 +356,8 @@ public void testLIAExistsArrayConjunct2() throws SolverException, InterruptedExc
387356

388357
@Test
389358
public void testBVExistsArrayConjunct2() throws SolverException, InterruptedException {
390-
assume()
391-
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
392-
.that(solverToUse())
393-
.isNotEqualTo(Solvers.CVC5);
394-
395359
// (exists x . b[x] = 1) AND (forall x . b[x] = 0) is UNSAT
396360
setUpBV();
397-
// Princess does not support bitvectors in arrays
398-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS);
399361

400362
BooleanFormula f =
401363
bmgr.and(qmgr.exists(ImmutableList.of(xbv), bvArray_at_x_eq_1), bv_forall_x_a_at_x_eq_0);
@@ -463,8 +425,10 @@ public void testLIAExistsArrayDisjunct1() throws SolverException, InterruptedExc
463425
public void testBVExistsArrayDisjunct1() throws SolverException, InterruptedException {
464426
// (exists x . b[x] = 0) OR (forall x . b[x] = 1) is SAT
465427
setUpBV();
466-
// Princess does not support bitvectors in arrays
467-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS);
428+
assume()
429+
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
430+
.that(solverToUse())
431+
.isNotEqualTo(Solvers.PRINCESS);
468432

469433
BooleanFormula f =
470434
bmgr.or(
@@ -489,8 +453,6 @@ public void testLIAExistsArrayDisjunct2() throws SolverException, InterruptedExc
489453
public void testBVExistsArrayDisjunct2() throws SolverException, InterruptedException {
490454
// (exists x . b[x] = 1) OR (exists x . b[x] = 1) is SAT
491455
setUpBV();
492-
// Princess does not support bitvectors in arrays
493-
assume().that(solverToUse()).isNotEqualTo(Solvers.PRINCESS);
494456

495457
BooleanFormula f =
496458
bmgr.or(
@@ -822,11 +784,6 @@ public void testIntrospectionExistsInteger() {
822784

823785
@Test
824786
public void testEmpty() {
825-
assume()
826-
.withMessage("TODO: The JavaSMT code for Princess explicitly allows this.")
827-
.that(solverToUse())
828-
.isNotEqualTo(Solvers.PRINCESS);
829-
830787
// An empty list of quantified variables throws an exception.
831788
assertThrows(
832789
IllegalArgumentException.class,
@@ -884,11 +841,10 @@ public void checkBVQuantifierEliminationFail() throws InterruptedException, Solv
884841
requireBitvectors();
885842
requireQuantifierElimination();
886843
// Boolector quants need to be reworked
887-
// Princess does not support bitvectors in arrays
888844
assume()
889845
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
890846
.that(solverToUse())
891-
.isNoneOf(Solvers.CVC5, Solvers.PRINCESS);
847+
.isNotEqualTo(Solvers.CVC5);
892848

893849
int width = 2;
894850
BitvectorFormula xx = bvmgr.makeVariable(width, "x_bv");
@@ -941,8 +897,6 @@ public void checkBVQuantifierElimination2() throws InterruptedException, SolverE
941897
// quantifier-free equivalent: (and (= b2 #x00000006)
942898
// (= a3 #x00000000))
943899

944-
// Z3 fails this currently. Remove once that's not longer the case!
945-
assume().that(solverToUse()).isNotEqualTo(Solvers.Z3);
946900
int width = 32;
947901

948902
BitvectorFormula a2 = bvmgr.makeVariable(width, "a2");
@@ -968,11 +922,6 @@ public void checkBVQuantifierElimination2() throws InterruptedException, SolverE
968922
@Test
969923
public void testExistsRestrictedRange() throws SolverException, InterruptedException {
970924
setUpLIA();
971-
assume()
972-
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
973-
.that(solverToUse())
974-
.isNotEqualTo(Solvers.CVC5);
975-
976925
ArrayFormula<IntegerFormula, IntegerFormula> b =
977926
amgr.makeArray("b", FormulaType.IntegerType, FormulaType.IntegerType);
978927
BooleanFormula bAtXEq1 = imgr.equal(amgr.select(b, x), imgr.makeNumber(1));
@@ -1026,10 +975,6 @@ public void testExistsRestrictedRangeWithoutInconclusiveSolvers()
1026975
@Test
1027976
public void testForallRestrictedRange() throws SolverException, InterruptedException {
1028977
setUpLIA();
1029-
assume()
1030-
.withMessage("Solver %s does not support the complete theory of quantifiers", solverToUse())
1031-
.that(solverToUse())
1032-
.isNotEqualTo(Solvers.CVC5);
1033978

1034979
ArrayFormula<IntegerFormula, IntegerFormula> b =
1035980
amgr.makeArray("b", FormulaType.IntegerType, FormulaType.IntegerType);

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ public void setupEnvironment() {
7777
// TODO how can we support allsat in MathSat5-interpolation-prover?
7878
assume().that(solverToUse()).isNotEqualTo(Solvers.MATHSAT5);
7979

80-
// CVC4 and Boolector do not support interpolation
81-
assume().that(solverToUse()).isNoneOf(Solvers.CVC4, Solvers.BOOLECTOR, Solvers.Z3);
82-
8380
env = context.newProverEnvironmentWithInterpolation(ProverOptions.GENERATE_ALL_SAT);
8481
break;
8582

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ protected void requireParser() {
349349
}
350350

351351
protected void requireArrayModel() {
352-
// INFO: OpenSmt does not support model generation for array
353352
assume()
354353
.withMessage("Solver %s does not support model generation for arrays", solverToUse())
355354
.that(solverToUse())

0 commit comments

Comments
 (0)