File tree 2 files changed +25
-1
lines changed
src/solvers/smt2_incremental
unit/solvers/smt2_incremental 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,20 @@ static smt_responset get_response_to_command(
32
32
return response;
33
33
}
34
34
35
+ static optionalt<std::string>
36
+ get_problem_messages (const smt_responset &response)
37
+ {
38
+ if (const auto error = response.cast <smt_error_responset>())
39
+ {
40
+ return " SMT solver returned an error message - " + id2string (error->message ());
41
+ }
42
+ if (response.cast <smt_unsupported_responset>())
43
+ {
44
+ return {" SMT solver does not support given command." };
45
+ }
46
+ return {};
47
+ }
48
+
35
49
// / \brief Find all sub expressions of the given \p expr which need to be
36
50
// / expressed as separate smt commands.
37
51
// / \return A collection of sub expressions, which need to be expressed as
@@ -237,5 +251,7 @@ decision_proceduret::resultt smt2_incremental_decision_proceduret::dec_solve()
237
251
log .error () << " SMT2 solver returned \" unknown\" " << messaget::eom;
238
252
return lookup_decision_procedure_result (check_sat_response->kind ());
239
253
}
240
- UNIMPLEMENTED_FEATURE (" handling solver response." );
254
+ if (const auto problem = get_problem_messages (result))
255
+ throw analysis_exceptiont{*problem};
256
+ throw analysis_exceptiont{" Unexpected kind of response from SMT solver." };
241
257
}
Original file line number Diff line number Diff line change @@ -294,3 +294,11 @@ TEST_CASE("smt2_incremental_decision_proceduret receives success and check-sat r
294
294
test.mock_responses = {smt_success_responset{}, smt_check_sat_responset{smt_sat_responset{}}};
295
295
REQUIRE_NOTHROW (test.procedure ());
296
296
}
297
+
298
+ TEST_CASE (" smt2_incremental_decision_proceduret receives unexpected response." )
299
+ {
300
+ decision_procedure_test_environmentt test{};
301
+ test.mock_responses =
302
+ {smt_get_value_responset{{{" x" , smt_bool_literal_termt{false }}}}};
303
+ REQUIRE_THROWS (test.procedure ());
304
+ }
You can’t perform that action at this time.
0 commit comments