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 18
18
19
19
#include < stack>
20
20
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
+
21
35
// / \brief Find all sub expressions of the given \p expr which need to be
22
36
// / expressed as separate smt commands.
23
37
// / \return A collection of sub expressions, which need to be expressed as
@@ -214,8 +228,8 @@ static decision_proceduret::resultt lookup_decision_procedure_result(
214
228
decision_proceduret::resultt smt2_incremental_decision_proceduret::dec_solve ()
215
229
{
216
230
++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{} );
219
233
if (const auto check_sat_response = result.cast <smt_check_sat_responset>())
220
234
{
221
235
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(
286
286
CHECK (test.procedure () == decision_proceduret::resultt::D_ERROR);
287
287
}
288
288
}
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