mirror of
https://github.com/Z3Prover/z3
synced 2025-04-13 20:38:43 +00:00
add test routines to nla_expr
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
9266ab7ed1
commit
63748206fe
|
@ -556,6 +556,41 @@ public:
|
|||
}
|
||||
|
||||
bool done() const { return m_done; }
|
||||
#if Z3DEBUG
|
||||
nex *clone (nex * a) {
|
||||
switch (a->type()) {
|
||||
case expr_type::VAR: {
|
||||
auto v = to_var(a);
|
||||
return mk_var(v->var());
|
||||
}
|
||||
|
||||
case expr_type::SCALAR: {
|
||||
auto v = to_scalar(a);
|
||||
return mk_scalar(v->value());
|
||||
}
|
||||
case expr_type::MUL: {
|
||||
auto m = to_mul(a);
|
||||
auto r = mk_mul();
|
||||
for (nex * e : m->children()) {
|
||||
r->add_child(clone(e));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
case expr_type::SUM: {
|
||||
auto m = to_sum(a);
|
||||
auto r = mk_sum();
|
||||
for (nex * e : m->children()) {
|
||||
r->add_child(clone(e));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
default:
|
||||
SASSERT(false);
|
||||
break;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ void test_cn() {
|
|||
nex_mul* bcg = cn.mk_mul(b, c, g);
|
||||
bcg->add_child(min_1);
|
||||
nex_sum* t = cn.mk_sum(bcd, bcg);
|
||||
// test_cn_on_expr(t, cn);
|
||||
test_cn_on_expr(t, cn);
|
||||
nex* aad = cn.mk_mul(a, a, d);
|
||||
nex* abcd = cn.mk_mul(a, b, c, d);
|
||||
nex* aaccd = cn.mk_mul(a, a, c, c, d);
|
||||
|
@ -101,7 +101,9 @@ void test_cn() {
|
|||
nex* eae = cn.mk_mul(e, a, e);
|
||||
nex* eac = cn.mk_mul(e, a, c);
|
||||
nex* ed = cn.mk_mul(e, d);
|
||||
nex* _6aad = cn.mk_mul(cn.mk_scalar(rational(6)), a, a, d);
|
||||
nex* _6aad = cn.mk_mul(cn.mk_scalar(rational(6)), a, a, d);
|
||||
nex * clone = cn.clone(cn.mk_sum(_6aad, abcd, aaccd, add, eae, eac, ed));
|
||||
TRACE("nla_cn", tout << "clone = " << *clone << "\n";);
|
||||
// test_cn_on_expr(cn.mk_sum(aad, abcd, aaccd, add, eae, eac, ed), cn);
|
||||
test_cn_on_expr(cn.mk_sum(_6aad, abcd, aaccd, add, eae, eac, ed), cn);
|
||||
// TRACE("nla_cn", tout << "done\n";);
|
||||
|
|
Loading…
Reference in a new issue