File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
src/solvers/smt2_incremental
unit/solvers/smt2_incremental Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 1818
1919#include < stack>
2020
21+ // / Issues a command to the solving process which is expected to optionally
22+ // / return a success status followed by the actual response of interest.
23+ static smt_responset get_response_to_command (
24+ smt_base_solver_processt &solver_process,
25+ const smt_commandt &command)
26+ {
27+ solver_process.send (command);
28+ auto response = solver_process.receive_response ();
29+ if (response.cast <smt_success_responset>())
30+ return solver_process.receive_response ();
31+ else
32+ return response;
33+ }
34+
2135// / \brief Find all sub expressions of the given \p expr which need to be
2236// / expressed as separate smt commands.
2337// / \return A collection of sub expressions, which need to be expressed as
@@ -214,8 +228,8 @@ static decision_proceduret::resultt lookup_decision_procedure_result(
214228decision_proceduret::resultt smt2_incremental_decision_proceduret::dec_solve ()
215229{
216230 ++number_of_solver_calls;
217- solver_process-> send (smt_check_sat_commandt{});
218- const smt_responset result = solver_process-> receive_response ( );
231+ const smt_responset result =
232+ get_response_to_command (*solver_process, smt_check_sat_commandt{} );
219233 if (const auto check_sat_response = result.cast <smt_check_sat_responset>())
220234 {
221235 if (check_sat_response->kind ().cast <smt_unknown_responset>())
Original file line number Diff line number Diff line change @@ -286,3 +286,14 @@ TEST_CASE(
286286 CHECK (test.procedure () == decision_proceduret::resultt::D_ERROR);
287287 }
288288}
289+
290+ TEST_CASE (
291+ " smt2_incremental_decision_proceduret receives success and check-sat "
292+ " response." ,
293+ " [core][smt2_incremental]" )
294+ {
295+ decision_procedure_test_environmentt test{};
296+ test.mock_responses = {smt_success_responset{},
297+ smt_check_sat_responset{smt_sat_responset{}}};
298+ REQUIRE_NOTHROW (test.procedure ());
299+ }
You can’t perform that action at this time.
0 commit comments