(Context ctx)
| 313 | } |
| 314 | |
| 315 | void modelConverterTest(Context ctx) throws TestFailedException |
| 316 | { |
| 317 | System.out.println("ModelConverterTest"); |
| 318 | |
| 319 | ArithExpr xr = (ArithExpr) ctx.mkConst(ctx.mkSymbol("x"), |
| 320 | ctx.mkRealSort()); |
| 321 | ArithExpr yr = (ArithExpr) ctx.mkConst(ctx.mkSymbol("y"), |
| 322 | ctx.mkRealSort()); |
| 323 | Goal g4 = ctx.mkGoal(true, false, false); |
| 324 | g4.add(ctx.mkGt(xr, ctx.mkReal(10, 1))); |
| 325 | g4.add(ctx.mkEq(yr, ctx.mkAdd(xr, ctx.mkReal(1, 1)))); |
| 326 | g4.add(ctx.mkGt(yr, ctx.mkReal(1, 1))); |
| 327 | |
| 328 | ApplyResult ar = applyTactic(ctx, ctx.mkTactic("simplify"), g4); |
| 329 | if (ar.getNumSubgoals() == 1 |
| 330 | && (ar.getSubgoals()[0].isDecidedSat() || ar.getSubgoals()[0] |
| 331 | .isDecidedUnsat())) |
| 332 | throw new TestFailedException(); |
| 333 | |
| 334 | ar = applyTactic(ctx, ctx.andThen(ctx.mkTactic("simplify"), |
| 335 | ctx.mkTactic("solve-eqs")), g4); |
| 336 | if (ar.getNumSubgoals() == 1 |
| 337 | && (ar.getSubgoals()[0].isDecidedSat() || ar.getSubgoals()[0] |
| 338 | .isDecidedUnsat())) |
| 339 | throw new TestFailedException(); |
| 340 | |
| 341 | Solver s = ctx.mkSolver(); |
| 342 | for (BoolExpr e : ar.getSubgoals()[0].getFormulas()) |
| 343 | s.add(e); |
| 344 | Status q = s.check(); |
| 345 | System.out.println("Solver says: " + q); |
| 346 | System.out.println("Model: \n" + s.getModel()); |
| 347 | if (q != Status.SATISFIABLE) |
| 348 | throw new TestFailedException(); |
| 349 | } |
| 350 | |
| 351 | // / A simple array example. |
| 352 |
no test coverage detected