@@ -2431,6 +2431,32 @@ public void testDeeplyNestedFormulaBV() throws SolverException, InterruptedExcep
24312431 var -> bvmgr .equal (var , bvmgr .makeBitvector (4 , 1 )));
24322432 }
24332433
2434+ @ Test
2435+ public void testModelAfterUnsatInt () throws SolverException , InterruptedException {
2436+ requireIntegers ();
2437+ try (ProverEnvironment prover = context .newProverEnvironment (ProverOptions .GENERATE_MODELS )) {
2438+ HardIntegerFormulaGenerator gen = new HardIntegerFormulaGenerator (imgr , bmgr );
2439+ prover .push (gen .generate (8 ));
2440+
2441+ assertThat (prover ).isUnsatisfiable ();
2442+
2443+ assertThrows (IllegalStateException .class , prover ::getModel );
2444+ }
2445+ }
2446+
2447+ @ Test
2448+ public void testModelAfterUnsatBv () throws SolverException , InterruptedException {
2449+ requireBitvectors ();
2450+ try (ProverEnvironment prover = context .newProverEnvironment (ProverOptions .GENERATE_MODELS )) {
2451+ HardBitvectorFormulaGenerator gen = new HardBitvectorFormulaGenerator (bvmgr , bmgr );
2452+ prover .push (gen .generate (8 ));
2453+
2454+ assertThat (prover ).isUnsatisfiable ();
2455+
2456+ assertThrows (IllegalStateException .class , prover ::getModel );
2457+ }
2458+ }
2459+
24342460 /**
24352461 * Build a deep nesting that is easy to solve and can not be simplified by the solver. If any part
24362462 * of JavaSMT or the solver tries to analyse all branches of this formula, the runtime is
@@ -2459,7 +2485,9 @@ private <T> void testDeeplyNestedFormula(
24592485 private void evaluateInModel (BooleanFormula constraint , Formula variable , Object expectedValue )
24602486 throws SolverException , InterruptedException {
24612487
2462- try (ProverEnvironment prover = context .newProverEnvironment (ProverOptions .GENERATE_MODELS )) {
2488+ try (ProverEnvironment prover =
2489+ context .newProverEnvironment (
2490+ ProverOptions .GENERATE_MODELS , ProverOptions .GENERATE_UNSAT_CORE )) {
24632491 prover .push (constraint );
24642492 assertThat (prover ).isSatisfiable ();
24652493
0 commit comments