예제 #1
0
        public void branchFeasibilityTrivialQueryExpr(bool trueBranch, Solver.Result expectedTrueBranch, Solver.Result expectedFalseBranch)
        {
            var builder = GetBuilder();
            var solver  = new Solver.SimpleSolver(GetSolverImpl());
            var xVar    = GetVar("x");

            var constraint0Expr = builder.Lt(xVar.Expr, builder.ConstantInt(0));
            var constraint0     = new Constraint(constraint0Expr);
            var cm = GetConstraintManager();

            cm.AddConstraint(constraint0);

            var result = solver.CheckBranchSatisfiability(cm, new Constraint(builder.ConstantBool(trueBranch)), builder);

            Assert.AreEqual(expectedTrueBranch, result.TrueBranch);
            Assert.AreEqual(expectedFalseBranch, result.FalseBranch);
        }
예제 #2
0
        public void branchFeasibilityNonTrivialOnlyFalseBranch()
        {
            var builder = GetBuilder();
            var solver  = new Solver.SimpleSolver(GetSolverImpl());
            var xVar    = GetVar("x");

            var constraint0Expr = builder.Lt(xVar.Expr, builder.ConstantInt(0));
            var constraint0     = new Constraint(constraint0Expr);
            var cm = GetConstraintManager();

            cm.AddConstraint(constraint0);

            var queryExpr = builder.Gt(xVar.Expr, builder.ConstantInt(1));

            var result = solver.CheckBranchSatisfiability(cm, new Constraint(queryExpr), builder);

            Assert.AreEqual(Solver.Result.UNSAT, result.TrueBranch);
            Assert.AreEqual(Solver.Result.SAT, result.FalseBranch);
        }