File tree 2 files changed +24
-1
lines changed
src/solvers/smt2_incremental
unit/solvers/smt2_incremental 2 files changed +24
-1
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 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 (smt_check_sat_commandt{});
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
@@ -215,7 +229,8 @@ decision_proceduret::resultt smt2_incremental_decision_proceduret::dec_solve()
215
229
{
216
230
++number_of_solver_calls;
217
231
solver_process->send (smt_check_sat_commandt{});
218
- const smt_responset result = solver_process->receive_response ();
232
+ const smt_responset result =
233
+ get_response_to_command (*solver_process, smt_check_sat_commandt{});
219
234
if (const auto check_sat_response = result.cast <smt_check_sat_responset>())
220
235
{
221
236
if (check_sat_response->kind ().cast <smt_unknown_responset>())
Original file line number Diff line number Diff line change @@ -286,3 +286,11 @@ TEST_CASE(
286
286
CHECK (test.procedure () == decision_proceduret::resultt::D_ERROR);
287
287
}
288
288
}
289
+
290
+ TEST_CASE (" smt2_incremental_decision_proceduret receives success and check-sat response." ,
291
+ " [core][smt2_incremental]" )
292
+ {
293
+ decision_procedure_test_environmentt test{};
294
+ test.mock_responses = {smt_success_responset{}, smt_check_sat_responset{smt_sat_responset{}}};
295
+ REQUIRE_NOTHROW (test.procedure ());
296
+ }
You can’t perform that action at this time.
0 commit comments