(Context ctx)
| 769 | // / Some basic tests. |
| 770 | |
| 771 | void basicTests(Context ctx) throws TestFailedException |
| 772 | { |
| 773 | System.out.println("BasicTests"); |
| 774 | |
| 775 | Symbol fname = ctx.mkSymbol("f"); |
| 776 | Symbol x = ctx.mkSymbol("x"); |
| 777 | Symbol y = ctx.mkSymbol("y"); |
| 778 | |
| 779 | Sort bs = ctx.mkBoolSort(); |
| 780 | |
| 781 | Sort[] domain = { bs, bs }; |
| 782 | FuncDecl f = ctx.mkFuncDecl(fname, domain, bs); |
| 783 | Expr fapp = ctx.mkApp(f, ctx.mkConst(x, bs), ctx.mkConst(y, bs)); |
| 784 | |
| 785 | Expr[] fargs2 = { ctx.mkFreshConst("cp", bs) }; |
| 786 | Sort[] domain2 = { bs }; |
| 787 | Expr fapp2 = ctx.mkApp(ctx.mkFreshFuncDecl("fp", domain2, bs), fargs2); |
| 788 | |
| 789 | BoolExpr trivial_eq = ctx.mkEq(fapp, fapp); |
| 790 | BoolExpr nontrivial_eq = ctx.mkEq(fapp, fapp2); |
| 791 | |
| 792 | Goal g = ctx.mkGoal(true, false, false); |
| 793 | g.add(trivial_eq); |
| 794 | g.add(nontrivial_eq); |
| 795 | System.out.println("Goal: " + g); |
| 796 | |
| 797 | Solver solver = ctx.mkSolver(); |
| 798 | |
| 799 | for (BoolExpr a : g.getFormulas()) |
| 800 | solver.add(a); |
| 801 | |
| 802 | if (solver.check() != Status.SATISFIABLE) |
| 803 | throw new TestFailedException(); |
| 804 | |
| 805 | ApplyResult ar = applyTactic(ctx, ctx.mkTactic("simplify"), g); |
| 806 | if (ar.getNumSubgoals() == 1 |
| 807 | && (ar.getSubgoals()[0].isDecidedSat() || ar.getSubgoals()[0] |
| 808 | .isDecidedUnsat())) |
| 809 | throw new TestFailedException(); |
| 810 | |
| 811 | ar = applyTactic(ctx, ctx.mkTactic("smt"), g); |
| 812 | if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedSat()) |
| 813 | throw new TestFailedException(); |
| 814 | |
| 815 | g.add(ctx.mkEq(ctx.mkNumeral(1, ctx.mkBitVecSort(32)), |
| 816 | ctx.mkNumeral(2, ctx.mkBitVecSort(32)))); |
| 817 | ar = applyTactic(ctx, ctx.mkTactic("smt"), g); |
| 818 | if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedUnsat()) |
| 819 | throw new TestFailedException(); |
| 820 | |
| 821 | Goal g2 = ctx.mkGoal(true, true, false); |
| 822 | ar = applyTactic(ctx, ctx.mkTactic("smt"), g2); |
| 823 | if (ar.getNumSubgoals() != 1 || !ar.getSubgoals()[0].isDecidedSat()) |
| 824 | throw new TestFailedException(); |
| 825 | |
| 826 | g2 = ctx.mkGoal(true, true, false); |
| 827 | g2.add(ctx.mkFalse()); |
| 828 | ar = applyTactic(ctx, ctx.mkTactic("smt"), g2); |
no test coverage detected