mirror of
https://github.com/Z3Prover/z3
synced 2025-10-07 00:11:55 +00:00
updated unit tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
2b2ba2d541
commit
f94bdf4035
6 changed files with 346 additions and 84 deletions
|
@ -415,8 +415,8 @@ void doc_manager::subtract(doc const& A, doc const& B, ptr_vector<doc>& result)
|
|||
r2 = allocate(B.neg()[i]);
|
||||
if (set_and(*r, *r2)) {
|
||||
result.push_back(r.detach());
|
||||
r = allocate(A);
|
||||
}
|
||||
r = allocate(A);
|
||||
}
|
||||
}
|
||||
bool doc_manager::equals(doc const& a, doc const& b) const {
|
||||
|
|
|
@ -22,16 +22,20 @@ Revision History:
|
|||
#include "hashtable.h"
|
||||
|
||||
|
||||
//#define _DEBUG_MEM 1
|
||||
#define _DEBUG_MEM 0
|
||||
static bool s_debug_alloc = false;
|
||||
|
||||
void tbv_manager::debug_alloc() {
|
||||
s_debug_alloc = true;
|
||||
}
|
||||
|
||||
tbv_manager::~tbv_manager() {
|
||||
#if _DEBUG_MEM
|
||||
ptr_vector<tbv>::iterator it = allocated_tbvs.begin(), end = allocated_tbvs.end();
|
||||
for (; it != end; ++it) {
|
||||
std::cout << "dangling: " << (*it) << "\n";
|
||||
}
|
||||
#endif
|
||||
DEBUG_CODE(
|
||||
ptr_vector<tbv>::iterator it = allocated_tbvs.begin();
|
||||
ptr_vector<tbv>::iterator end = allocated_tbvs.end();
|
||||
for (; it != end; ++it) {
|
||||
std::cout << "dangling: " << (*it) << "\n";
|
||||
TRACE("doc", tout << "dangling: " << (*it) << "\n";);
|
||||
});
|
||||
}
|
||||
|
||||
void tbv_manager::reset() {
|
||||
|
@ -39,10 +43,12 @@ void tbv_manager::reset() {
|
|||
}
|
||||
tbv* tbv_manager::allocate() {
|
||||
tbv* r = reinterpret_cast<tbv*>(m.allocate());
|
||||
#if _DEBUG_MEM
|
||||
std::cout << allocated_tbvs.size() << " " << r << "\n";
|
||||
allocated_tbvs.insert(r);
|
||||
#endif
|
||||
DEBUG_CODE(
|
||||
if (s_debug_alloc) {
|
||||
TRACE("doc", tout << allocated_tbvs.size() << " " << r << "\n";);
|
||||
}
|
||||
allocated_tbvs.insert(r);
|
||||
);
|
||||
return r;
|
||||
}
|
||||
tbv* tbv_manager::allocate1() {
|
||||
|
@ -145,14 +151,15 @@ tbv* tbv_manager::allocate(rational const& r) {
|
|||
return v;
|
||||
}
|
||||
void tbv_manager::deallocate(tbv* bv) {
|
||||
#if _DEBUG_MEM
|
||||
if (!allocated_tbvs.contains(bv)) {
|
||||
std::cout << "double deallocate: " << bv << "\n";
|
||||
UNREACHABLE();
|
||||
}
|
||||
std::cout << "deallocate: " << bv << "\n";
|
||||
allocated_tbvs.erase(bv);
|
||||
#endif
|
||||
DEBUG_CODE(
|
||||
if (!allocated_tbvs.contains(bv)) {
|
||||
std::cout << "double deallocate: " << bv << "\n";
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (s_debug_alloc) {
|
||||
TRACE("doc", tout << "deallocate: " << bv << "\n";);
|
||||
}
|
||||
allocated_tbvs.erase(bv););
|
||||
m.deallocate(bv);
|
||||
}
|
||||
void tbv_manager::copy(tbv& dst, tbv const& src) const {
|
||||
|
|
|
@ -73,6 +73,8 @@ public:
|
|||
std::ostream& display(std::ostream& out, tbv const& b) const;
|
||||
tbv* project(unsigned n, bool const* to_delete, tbv const& src);
|
||||
bool is_well_formed(tbv const& b) const; // - does not contain BIT_z;
|
||||
|
||||
static void debug_alloc();
|
||||
};
|
||||
|
||||
class tbv: private fixed_bit_vector {
|
||||
|
@ -132,6 +134,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
tbv& operator*() { return *d; }
|
||||
tbv* operator->() { return d; }
|
||||
tbv* get() { return d; }
|
||||
tbv* detach() { tbv* result = d; d = 0; return result; }
|
||||
};
|
||||
|
|
|
@ -667,6 +667,7 @@ namespace datalog {
|
|||
TRACE("doc", sub.display(dm, tout << "sub:") << "\n";);
|
||||
result.subtract(dm, sub);
|
||||
result.simplify(dm);
|
||||
sub.reset(dm);
|
||||
TRACE("doc", result.display(dm, tout << "result:") << "\n";);
|
||||
|
||||
}
|
||||
|
@ -678,7 +679,11 @@ namespace datalog {
|
|||
arg = mk_not(m, to_app(g)->get_arg(i));
|
||||
apply_guard(arg, sub, equalities, discard_cols);
|
||||
}
|
||||
TRACE("doc", result.display(dm, tout << "result0:") << "\n";);
|
||||
result.subtract(dm, sub);
|
||||
TRACE("doc",
|
||||
sub.display(dm, tout << "sub:") << "\n";
|
||||
result.display(dm, tout << "result:") << "\n";);
|
||||
sub.reset(dm);
|
||||
}
|
||||
else if (m.is_true(g)) {
|
||||
|
@ -897,7 +902,7 @@ namespace datalog {
|
|||
for (unsigned i = 0; i < m_removed_cols.size(); ++i) {
|
||||
m_col_list.set(m_removed_cols[i], true);
|
||||
}
|
||||
m_to_delete.resize(m_removed_cols.size(), false);
|
||||
m_to_delete.resize(t.get_num_bits(), false);
|
||||
for (unsigned i = 0; i < m_removed_cols.size(); ++i) {
|
||||
m_to_delete[m_removed_cols[i]] = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue