{
#define CVC4_API_SOLVER_TRY_CATCH_END \
} \
+ catch (const CVC4::RecoverableModalException& e) \
+ { \
+ throw CVC4ApiRecoverableException(e.getMessage()); \
+ } \
catch (const CVC4::Exception& e) { throw CVC4ApiException(e.getMessage()); } \
catch (const std::invalid_argument& e) { throw CVC4ApiException(e.what()); }
std::string d_msg;
};
+class CVC4_PUBLIC CVC4ApiRecoverableException : public CVC4ApiException
+{
+ public:
+ CVC4ApiRecoverableException(const std::string& str) : CVC4ApiException(str) {}
+ CVC4ApiRecoverableException(const std::stringstream& stream)
+ : CVC4ApiException(stream.str())
+ {
+ }
+};
+
/* -------------------------------------------------------------------------- */
/* Result */
/* -------------------------------------------------------------------------- */
void setUp() override;
void tearDown() override;
+ void testRecoverableException();
+
void testSupportsFloatingPoint();
void testGetBooleanSort();
void SolverBlack::tearDown() { d_solver.reset(nullptr); }
+void SolverBlack::testRecoverableException()
+{
+ d_solver->setOption("produce-models", "true");
+ Term x = d_solver->mkConst(d_solver->getBooleanSort(), "x");
+ d_solver->assertFormula(x.eqTerm(x).notTerm());
+ TS_ASSERT_THROWS(d_solver->printModel(std::cout), CVC4ApiRecoverableException&);
+}
+
void SolverBlack::testSupportsFloatingPoint()
{
if (d_solver->supportsFloatingPoint())