summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-08-13 18:03:54 -0700
committerGitHub <noreply@github.com>2018-08-13 18:03:54 -0700
commit94e3d283a58684118e06f9a698606e58574fa26f (patch)
tree0c9003984f65bf7f16f0a2b6d5cecfd7d531ed0d /src
parent957b02e415f60e725da569f1d7c0e2d1276cb3fa (diff)
Fix get-unsat-assumptions output (#2301)
Fixes #2298. The `get-unsat-assumptions` command was printing the result with square brackets and commas instead of parentheses and spaces between the assumptions.
Diffstat (limited to 'src')
-rw-r--r--src/smt/command.cpp3
-rw-r--r--src/util/utility.h12
2 files changed, 10 insertions, 5 deletions
diff --git a/src/smt/command.cpp b/src/smt/command.cpp
index 65d4396a9..2805d8793 100644
--- a/src/smt/command.cpp
+++ b/src/smt/command.cpp
@@ -35,6 +35,7 @@
#include "smt/smt_engine.h"
#include "smt/smt_engine_scope.h"
#include "util/sexpr.h"
+#include "util/utility.h"
using namespace std;
@@ -1873,7 +1874,7 @@ void GetUnsatAssumptionsCommand::printResult(std::ostream& out,
}
else
{
- out << d_result << endl;
+ container_to_stream(out, d_result, "(", ")\n", " ");
}
}
diff --git a/src/util/utility.h b/src/util/utility.h
index a9a9a29c3..56a68ca40 100644
--- a/src/util/utility.h
+++ b/src/util/utility.h
@@ -69,16 +69,20 @@ inline InputIterator find_if_unique(InputIterator first, InputIterator last, Pre
}
template <typename T>
-void container_to_stream(std::ostream& out, const T& container)
+void container_to_stream(std::ostream& out,
+ const T& container,
+ const char* prefix = "[",
+ const char* postfix = "]",
+ const char* sep = ", ")
{
- out << "[";
+ out << prefix;
bool is_first = true;
for (const auto& item : container)
{
- out << (!is_first ? ", " : "") << item;
+ out << (!is_first ? sep : "") << item;
is_first = false;
}
- out << "]";
+ out << postfix;
}
}/* CVC4 namespace */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback