Skip to content

Commit 249d3f0

Browse files
Merge pull request #6424 from thomasspriggs/tas/fix_get_value_printing
Fix printing of `smt_get_value_commandt`
2 parents ce2680b + 947aae8 commit 249d3f0

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/solvers/smt2_incremental/smt_commands.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ class smt_get_value_commandt : public smt_commandt,
8787
protected smt_termt::storert<smt_assert_commandt>
8888
{
8989
public:
90+
/// \brief This constructor constructs the `get-value` command, such that it
91+
/// stores a single descriptor for which the solver will be commanded to
92+
/// respond with a value.
93+
/// \note This class currently supports storing a single descriptor only,
94+
/// whereas the SMT-LIB standard version 2.6 supports one or more
95+
/// descriptors. Getting one value at a time is currently sufficient for our
96+
/// requirements. This class could be expanded should there be a need to get
97+
/// multiple values at once.
9098
explicit smt_get_value_commandt(smt_termt descriptor);
9199
const smt_termt &descriptor() const;
92100
};

src/solvers/smt2_incremental/smt_to_smt2_string.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class smt_command_to_string_convertert
334334

335335
void visit(const smt_get_value_commandt &get_value) override
336336
{
337-
os << "(get-value " << get_value.descriptor() << ")";
337+
os << "(get-value (" << get_value.descriptor() << "))";
338338
}
339339

340340
void visit(const smt_pop_commandt &pop) override

unit/solvers/smt2_incremental/smt_to_smt2_string.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ TEST_CASE(
6969
CHECK(smt_to_smt2_string(smt_exit_commandt{}) == "(exit)");
7070
}
7171

72+
TEST_CASE(
73+
"Test smt_get_value_commandt to string conversion",
74+
"[core][smt2_incremental]")
75+
{
76+
CHECK(
77+
smt_to_smt2_string(smt_get_value_commandt{
78+
smt_identifier_termt{"foo", smt_bool_sortt{}}}) == "(get-value (|foo|))");
79+
}
80+
7281
TEST_CASE(
7382
"Test smt_push_commandt to string conversion",
7483
"[core][smt2_incremental]")

0 commit comments

Comments
 (0)