Search in sources :

Example 1 with SolverParseException

use of org.evosuite.symbolic.solver.SolverParseException in project evosuite by EvoSuite.

the class Z3ResultParser method parseResult.

public SolverResult parseResult(String z3ResultStr) throws SolverParseException {
    if (z3ResultStr.startsWith("sat")) {
        logger.debug("Z3 outcome was SAT");
        // parse solution
        Map<String, Object> solution = parseModel(z3ResultStr);
        // return a SAT
        SolverResult satResult = SolverResult.newSAT(solution);
        return satResult;
    } else if (z3ResultStr.startsWith("unsat")) {
        logger.debug("Z3 outcome was UNSAT");
        // return an UNSAT
        SolverResult unsatResult = SolverResult.newUNSAT();
        return unsatResult;
    } else {
        logger.debug("Z3 output was " + z3ResultStr);
        throw new SolverParseException("Z3 output is unknown. We are unable to parse it to a proper solution!", z3ResultStr);
    }
}
Also used : SolverParseException(org.evosuite.symbolic.solver.SolverParseException) SolverResult(org.evosuite.symbolic.solver.SolverResult)

Example 2 with SolverParseException

use of org.evosuite.symbolic.solver.SolverParseException in project evosuite by EvoSuite.

the class CVC4ResultParser method parse.

public SolverResult parse(String cvc4ResultStr) throws SolverParseException, SolverErrorException, SolverTimeoutException {
    if (cvc4ResultStr.startsWith("sat")) {
        logger.debug("CVC4 outcome was SAT");
        SolverResult satResult = parseModel(cvc4ResultStr);
        return satResult;
    } else if (cvc4ResultStr.startsWith("unsat")) {
        logger.debug("CVC4 outcome was UNSAT");
        SolverResult unsatResult = SolverResult.newUNSAT();
        return unsatResult;
    } else if (cvc4ResultStr.startsWith("unknown")) {
        logger.debug("CVC4 outcome was UNKNOWN (probably due to timeout)");
        throw new SolverTimeoutException();
    } else if (cvc4ResultStr.startsWith("(error")) {
        logger.debug("CVC4 output was the following " + cvc4ResultStr);
        throw new SolverErrorException("An error (probably an invalid input) occurred while executing CVC4");
    } else {
        logger.debug("The following CVC4 output could not be parsed " + cvc4ResultStr);
        throw new SolverParseException("CVC4 output is unknown. We are unable to parse it to a proper solution!", cvc4ResultStr);
    }
}
Also used : SolverTimeoutException(org.evosuite.symbolic.solver.SolverTimeoutException) SolverErrorException(org.evosuite.symbolic.solver.SolverErrorException) SolverParseException(org.evosuite.symbolic.solver.SolverParseException) SolverResult(org.evosuite.symbolic.solver.SolverResult)

Aggregations

SolverParseException (org.evosuite.symbolic.solver.SolverParseException)2 SolverResult (org.evosuite.symbolic.solver.SolverResult)2 SolverErrorException (org.evosuite.symbolic.solver.SolverErrorException)1 SolverTimeoutException (org.evosuite.symbolic.solver.SolverTimeoutException)1