3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-27 16:38:45 +00:00

Centralize and document TRACE tags using X-macros (#7657)

* Introduce X-macro-based trace tag definition
- Created trace_tags.def to centralize TRACE tag definitions
- Each tag includes a symbolic name and description
- Set up enum class TraceTag for type-safe usage in TRACE macros

* Add script to generate Markdown documentation from trace_tags.def
- Python script parses trace_tags.def and outputs trace_tags.md

* Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled

* trace: improve trace tag handling system with hierarchical tagging

- Introduce hierarchical tag-class structure: enabling a tag class activates all child tags
- Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag
- Implement initial version of trace_tag.def using X(tag, tag_class, description)
  (class names and descriptions to be refined in a future update)

* trace: replace all string-based TRACE tags with enum TraceTag
- Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals

* trace : add cstring header

* trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py

* trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h.

* trace : Add TODO comment for future implementation of tag_class activation

* trace : Disable code related to tag_class until implementation is ready (#7663).
This commit is contained in:
LeeYoungJoon 2025-05-28 22:31:25 +09:00 committed by GitHub
parent d766292dab
commit 0a93ff515d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
583 changed files with 8698 additions and 7299 deletions

View file

@ -44,9 +44,9 @@ static void tst1() {
// ast_ref<var_ast> v3 (m.mk_var(1), m);
// ENSURE(v1 != v2);
// ENSURE(v1 == v3);
// TRACE("ast", tout << "resetting v1\n";);
// TRACE(ast, tout << "resetting v1\n";);
// v1.reset();
// TRACE("ast", tout << "overwriting v3\n";);
// TRACE(ast, tout << "overwriting v3\n";);
// v3 = v2;
// ast_ref<type_decl_ast> t1(m.mk_type_decl(symbol("int"), 0), m);
@ -83,7 +83,7 @@ static void tst3() {
// ast_manager m;
// ast_ref<> n(m.mk_var(1), m);
// n = m.mk_var(1);
// TRACE("ast", tout << n->get_id() << "\n";);
// TRACE(ast, tout << n->get_id() << "\n";);
}
static void tst4() {
@ -142,12 +142,12 @@ struct foo {
};
void tst_ast() {
TRACE("ast",
TRACE(ast,
tout << "sizeof(ast): " << sizeof(ast) << "\n";
tout << "sizeof(expr): " << sizeof(expr) << "\n";
tout << "sizeof(app): " << sizeof(app) << "\n";
);
TRACE("ast", tout << "sizeof(foo): " << sizeof(foo) << "\n";);
TRACE(ast, tout << "sizeof(foo): " << sizeof(foo) << "\n";);
tst1();
tst2();
tst3();

View file

@ -63,7 +63,7 @@ static unsigned to_int(model_core & mdl, expr_ref_vector & out) {
#define ENSURE_INT(mdl, out, expected) \
do { \
unsigned actual = to_int(mdl, out); \
TRACE("bit_blaster", \
TRACE(bit_blaster, \
display(tout, out); \
tout << "expected=" << (expected) << ", actual=" << actual << "\n"; \
); \
@ -193,9 +193,9 @@ void tst_le(ast_manager & m, unsigned sz) {
// bool t = true;
// bit_blaster blaster(m, t);
// blaster.mk_ule(sz, a.c_ptr(), b.c_ptr(), out);
// TRACE("bit_blaster", tout << mk_pp(out, m) << "\n";);
// TRACE(bit_blaster, tout << mk_pp(out, m) << "\n";);
// blaster.mk_sle(sz, a.c_ptr(), b.c_ptr(), out);
// TRACE("bit_blaster", tout << mk_pp(out, m) << "\n";);
// TRACE(bit_blaster, tout << mk_pp(out, m) << "\n";);
}
void tst_eqs(ast_manager & m, unsigned sz) {
@ -206,7 +206,7 @@ void tst_eqs(ast_manager & m, unsigned sz) {
// bool t = true;
// bit_blaster blaster(m, t);
// blaster.mk_eqs(sz, a.c_ptr(), b);
// TRACE("bit_blaster", display(tout, b, false););
// TRACE(bit_blaster, display(tout, b, false););
}
void tst_sh(ast_manager & m, unsigned sz) {
@ -218,13 +218,13 @@ void tst_sh(ast_manager & m, unsigned sz) {
// bool t = true;
// bit_blaster blaster(m, t);
// blaster.mk_shl(sz, a.c_ptr(), b.c_ptr(), c);
// TRACE("bit_blaster", tout << "shl\n"; display(tout, c););
// TRACE(bit_blaster, tout << "shl\n"; display(tout, c););
// c.reset();
// blaster.mk_lshr(sz, a.c_ptr(), b.c_ptr(), c);
// TRACE("bit_blaster", tout << "lshr\n"; display(tout, c););
// TRACE(bit_blaster, tout << "lshr\n"; display(tout, c););
// c.reset();
// blaster.mk_ashr(sz, a.c_ptr(), b.c_ptr(), c);
// TRACE("bit_blaster", tout << "ashr " << c.size() << "\n"; display(tout, c, false););
// TRACE(bit_blaster, tout << "ashr " << c.size() << "\n"; display(tout, c, false););
}
void tst_bit_blaster() {

View file

@ -121,13 +121,13 @@ static void tst4(unsigned num, unsigned N) {
for (unsigned i = 0; i < num; i++) {
int v = rand() % N;
if (rand() % 3 == 2) {
TRACE("chashtable", tout << "erase " << v << "\n";);
TRACE(chashtable, tout << "erase " << v << "\n";);
s.erase(v);
t.erase(v);
ENSURE(!t.contains(v));
}
else {
TRACE("chashtable", tout << "insert " << v << "\n";);
TRACE(chashtable, tout << "insert " << v << "\n";);
s.insert(v);
t.insert(v);
ENSURE(t.contains(v));

View file

@ -85,7 +85,7 @@ static void tst2() {
ENSURE(g.enable_edge(g.add_edge(3, 0, rational(2), l4)));
ENSURE(!g.enable_edge(g.add_edge(0, 1, rational(-1), l5)));
ENSURE(!g.is_feasible_dbg());
TRACE("diff_logic", g.display(tout););
TRACE(diff_logic, g.display(tout););
struct proc {
bool_vector found;
proc():
@ -106,7 +106,7 @@ static void tst2() {
ENSURE(p.found[6] == false);
g.pop(1);
ENSURE(g.is_feasible_dbg());
TRACE("diff_logic", g.display(tout););
TRACE(diff_logic, g.display(tout););
}
static int add_edge(dlg& g, dl_var src, dl_var dst, int weight, unsigned lit) {
@ -138,7 +138,7 @@ static void tst3() {
add_edge(g, 6, 10, 1, 610);
add_edge(g, 8, 10, 1, 810);
add_edge(g, 9, 10, 1, 910);
TRACE("diff_logic", g.display(tout););
TRACE(diff_logic, g.display(tout););
int e38 = g.add_edge(3, 8, rational(3), smt::literal(38));
std::cout << "Edge: " << e38 << "\n";

View file

@ -224,7 +224,7 @@ class test_doc_cls {
void project(doc const& d, doc_manager& m2, const bit_vector& to_delete, doc_ref& result) {
result = dm.project(m2, to_delete, d);
TRACE("doc",
TRACE(doc,
for (unsigned i = 0; i < m_vars.size(); ++i) {
tout << (to_delete.get(i)?"0":"1");
}
@ -250,7 +250,7 @@ class test_doc_cls {
doc_manager m2(num_bits);
doc_ref result(m2);
project(*d, m2, to_delete, result);
TRACE("doc",
TRACE(doc,
dm.display(tout, *d) << "\n";
m2.display(tout, *result) << "\n";);
fml2 = to_formula(*result, m2);
@ -342,7 +342,7 @@ class test_doc_cls {
solver.assert_expr(fml);
lbool res = solver.check();
if (res != l_false) {
TRACE("doc",
TRACE(doc,
tout << mk_pp(fml1, m) << "\n";
tout << mk_pp(fml2, m) << "\n";
);
@ -459,11 +459,11 @@ public:
mk_rand_udoc(3, 3, d2);
fml1 = to_formula(d1, dm);
fml2 = to_formula(d2, dm);
TRACE("doc",
TRACE(doc,
d1.display(dm, tout) << "\n";
d2.display(dm, tout) << "\n";);
d1.intersect(dm, d2);
TRACE("doc", d1.display(dm, tout) << "\n";);
TRACE(doc, d1.display(dm, tout) << "\n";);
ENSURE(d1.well_formed(dm));
fml3 = to_formula(d1, dm);
fml1 = m.mk_and(fml1, fml2);

View file

@ -38,12 +38,12 @@ static void test1() {
expr_ref y(m.mk_const("y", I), m);
auto* nx = get_node(g, a, a.mk_add(a.mk_add(y, y), a.mk_add(x, x)));
auto* ny = get_node(g, a, a.mk_add(a.mk_add(y, x), x));
TRACE("plugin", tout << "before merge\n" << g << "\n");
TRACE(plugin, tout << "before merge\n" << g << "\n");
g.merge(nx, ny, nullptr);
TRACE("plugin", tout << "before propagate\n" << g << "\n");
TRACE(plugin, tout << "before propagate\n" << g << "\n");
g.propagate();
TRACE("plugin", tout << "after propagate\n" << g << "\n");
TRACE(plugin, tout << "after propagate\n" << g << "\n");
g.merge(get_node(g, a, a.mk_add(x, a.mk_add(y, y))), get_node(g, a, a.mk_add(y, x)), nullptr);
g.propagate();
std::cout << g << "\n";
@ -64,12 +64,12 @@ static void test2() {
auto* nx = get_node(g, a, x);
auto* ny = get_node(g, a, y);
TRACE("plugin", tout << "before merge\n" << g << "\n");
TRACE(plugin, tout << "before merge\n" << g << "\n");
g.merge(nxy, nx, nullptr);
g.merge(nyx, ny, nullptr);
TRACE("plugin", tout << "before propagate\n" << g << "\n");
TRACE(plugin, tout << "before propagate\n" << g << "\n");
g.propagate();
TRACE("plugin", tout << "after propagate\n" << g << "\n");
TRACE(plugin, tout << "after propagate\n" << g << "\n");
SASSERT(nx->get_root() == ny->get_root());
g.merge(get_node(g, a, a.mk_add(x, a.mk_add(y, y))), get_node(g, a, a.mk_add(y, x)), nullptr);
g.propagate();
@ -92,9 +92,9 @@ static void test3() {
auto* ny = get_node(g, a, y);
g.merge(nxyy, nx, nullptr);
g.merge(nyxx, ny, nullptr);
TRACE("plugin", tout << "before propagate\n" << g << "\n");
TRACE(plugin, tout << "before propagate\n" << g << "\n");
g.propagate();
TRACE("plugin", tout << "after propagate\n" << g << "\n");
TRACE(plugin, tout << "after propagate\n" << g << "\n");
std::cout << g << "\n";
}

View file

@ -45,11 +45,11 @@ static void test1() {
expr_ref yy(bv.mk_concat(y1, bv.mk_concat(y2, y3)), m);
auto* nx = get_node(g, bv, xx);
auto* ny = get_node(g, bv, yy);
TRACE("bv", tout << "before merge\n" << g << "\n");
TRACE(bv, tout << "before merge\n" << g << "\n");
g.merge(nx, ny, nullptr);
TRACE("bv", tout << "before propagate\n" << g << "\n");
TRACE(bv, tout << "before propagate\n" << g << "\n");
g.propagate();
TRACE("bv", tout << "after propagate\n" << g << "\n");
TRACE(bv, tout << "after propagate\n" << g << "\n");
std::cout << g << "\n";
SASSERT(nx->get_root() == ny->get_root());
}
@ -120,7 +120,7 @@ static void test4() {
g.merge(get_node(g, bv, bv.mk_concat(a, x2)), get_node(g, bv, y), nullptr);
g.merge(get_node(g, bv, x1), get_node(g, bv, a), nullptr);
g.propagate();
TRACE("bv", tout << g << "\n");
TRACE(bv, tout << g << "\n");
SASSERT(get_node(g, bv, bv.mk_extract(23, 8, x))->get_root() == get_node(g, bv, y)->get_root());
}
@ -138,11 +138,11 @@ static void test5() {
expr_ref x2(bv.mk_extract(27, 0, x), m);
auto* nx = get_node(g, bv, x1);
auto* ny = get_node(g, bv, x2);
TRACE("bv", tout << "before merge\n" << g << "\n");
TRACE(bv, tout << "before merge\n" << g << "\n");
g.merge(nx, ny, nullptr);
TRACE("bv", tout << "before propagate\n" << g << "\n");
TRACE(bv, tout << "before propagate\n" << g << "\n");
g.propagate();
TRACE("bv", tout << "after propagate\n" << g << "\n");
TRACE(bv, tout << "after propagate\n" << g << "\n");
std::cout << g << "\n";
}
@ -160,11 +160,11 @@ static void test6() {
expr_ref x2(bv.mk_extract(28, 0, x), m);
auto* nx = get_node(g, bv, x1);
auto* ny = get_node(g, bv, x2);
TRACE("bv", tout << "before merge\n" << g << "\n");
TRACE(bv, tout << "before merge\n" << g << "\n");
g.merge(nx, ny, nullptr);
TRACE("bv", tout << "before propagate\n" << g << "\n");
TRACE(bv, tout << "before propagate\n" << g << "\n");
g.propagate();
TRACE("bv", tout << "after propagate\n" << g << "\n");
TRACE(bv, tout << "after propagate\n" << g << "\n");
std::cout << g << "\n";
}

View file

@ -95,18 +95,18 @@ static void tst2() {
// insert
int val = heap_rand() % N;
if (!h.contains(val)) {
TRACE("heap", tout << "inserting: " << val << "\n";);
TRACE(heap, tout << "inserting: " << val << "\n";);
h.insert(val);
TRACE("heap", dump_heap(h, tout););
TRACE(heap, dump_heap(h, tout););
ENSURE(h.contains(val));
}
}
else if (cmd <= 6) {
int val = heap_rand() % N;
if (h.contains(val)) {
TRACE("heap", tout << "removing: " << val << "\n";);
TRACE(heap, tout << "removing: " << val << "\n";);
h.erase(val);
TRACE("heap", dump_heap(h, tout););
TRACE(heap, dump_heap(h, tout););
ENSURE(!h.contains(val));
}
}
@ -118,11 +118,11 @@ static void tst2() {
if (h.contains(val)) {
g_value[val] = new_v;
if (old_v < new_v) {
TRACE("heap", tout << "value of: " << val << " increased old: " << old_v << " new: " << new_v << "\n";);
TRACE(heap, tout << "value of: " << val << " increased old: " << old_v << " new: " << new_v << "\n";);
h.increased(val);
}
else {
TRACE("heap", tout << "value of: " << val << " decreased old: " << old_v << " new: " << new_v << "\n";);
TRACE(heap, tout << "value of: " << val << " decreased old: " << old_v << " new: " << new_v << "\n";);
h.decreased(val);
}
}

View file

@ -22,7 +22,7 @@ Revision History:
static void tst0() {
inf_rational n(rational(0), false);
TRACE("inf_rational", tout << n << "\n";);
TRACE(inf_rational, tout << n << "\n";);
ENSURE(n < inf_rational::zero());
ENSURE(!(n >= inf_rational::zero()));
}

View file

@ -31,12 +31,12 @@ static void tst1() {
ENSURE(append(r, l2, static_cast<list<int> *>(nullptr)) == l2);
ENSURE(append(r, static_cast<list<int> *>(nullptr), l2) == l2);
ENSURE(append(r, static_cast<list<int> *>(nullptr), static_cast<list<int> *>(nullptr)) == nullptr);
TRACE("list", display(tout, l2->begin(), l2->end()); tout << "\n";);
TRACE(list, display(tout, l2->begin(), l2->end()); tout << "\n";);
list<int> * l5 = append(r, l4, l2);
TRACE("list", display(tout, l5->begin(), l5->end()); tout << "\n";);
TRACE(list, display(tout, l5->begin(), l5->end()); tout << "\n";);
list<int> * l6 = append(r, l5, l5);
(void) l6;
TRACE("list", display(tout, l6->begin(), l6->end()); tout << "\n";);
TRACE(list, display(tout, l6->begin(), l6->end()); tout << "\n";);
}
void tst_list() {

View file

@ -57,7 +57,7 @@ struct gomory_test {
}
void real_case_in_gomory_cut(const mpq & a, unsigned x_j, mpq & k, lar_term& pol, explanation & expl, const mpq& f_0, const mpq& one_minus_f_0) {
TRACE("gomory_cut_detail_real", tout << "real\n";);
TRACE(gomory_cut_detail_real, tout << "real\n";);
mpq new_a;
if (at_low(x_j)) {
if (a.is_pos()) {
@ -83,7 +83,7 @@ struct gomory_test {
k.addmul(new_a, upper_bound(x_j).x); // k += upper_bound(x_j).x * new_a;
expl.add_pair(column_upper_bound_constraint(x_j), new_a);
}
TRACE("gomory_cut_detail_real", tout << a << "*v" << x_j << " k: " << k << "\n";);
TRACE(gomory_cut_detail_real, tout << a << "*v" << x_j << " k: " << k << "\n";);
pol.add_monomial(new_a, x_j);
}
@ -92,7 +92,7 @@ struct gomory_test {
SASSERT(!a.is_int());
SASSERT(f_0 > zero_of_type<mpq>() && f_0 < one_of_type<mpq>());
mpq f_j = fractional_part(a);
TRACE("gomory_cut_detail",
TRACE(gomory_cut_detail,
tout << a << " x_j = " << x_j << ", k = " << k << "\n";
tout << "f_j: " << f_j << "\n";
tout << "f_0: " << f_0 << "\n";
@ -123,7 +123,7 @@ struct gomory_test {
k.addmul(new_a, upper_bound(x_j).x);
expl.add_pair(column_upper_bound_constraint(x_j), new_a);
}
TRACE("gomory_cut_detail", tout << "new_a: " << new_a << " k: " << k << "\n";);
TRACE(gomory_cut_detail, tout << "new_a: " << new_a << " k: " << k << "\n";);
t.add_monomial(new_a, x_j);
lcm_den = lcm(lcm_den, denominator(new_a));
}
@ -138,7 +138,7 @@ struct gomory_test {
auto pol = t.coeffs_as_vector();
t.clear();
if (pol.size() == 1) {
TRACE("gomory_cut_detail", tout << "pol.size() is 1" << std::endl;);
TRACE(gomory_cut_detail, tout << "pol.size() is 1" << std::endl;);
unsigned v = pol[0].second;
SASSERT(is_integer(v));
const mpq& a = pol[0].first;
@ -155,9 +155,9 @@ struct gomory_test {
t.add_monomial(mpq(1), v);
}
} else {
TRACE("gomory_cut_detail", tout << "pol.size() > 1" << std::endl;);
TRACE(gomory_cut_detail, tout << "pol.size() > 1" << std::endl;);
lcm_den = lcm(lcm_den, denominator(k));
TRACE("gomory_cut_detail", tout << "k: " << k << " lcm_den: " << lcm_den << "\n";
TRACE(gomory_cut_detail, tout << "k: " << k << " lcm_den: " << lcm_den << "\n";
for (unsigned i = 0; i < pol.size(); i++) {
tout << pol[i].first << " " << pol[i].second << "\n";
}
@ -171,7 +171,7 @@ struct gomory_test {
}
k *= lcm_den;
}
TRACE("gomory_cut_detail", tout << "after *lcm\n";
TRACE(gomory_cut_detail, tout << "after *lcm\n";
for (unsigned i = 0; i < pol.size(); i++) {
tout << pol[i].first << " * v" << pol[i].second << "\n";
}
@ -182,7 +182,7 @@ struct gomory_test {
t.add_monomial(-pi.first, pi.second);
k.neg();
}
TRACE("gomory_cut_detail", tout << "k = " << k << std::endl;);
TRACE(gomory_cut_detail, tout << "k = " << k << std::endl;);
SASSERT(k.is_int());
}
@ -197,7 +197,7 @@ struct gomory_test {
enable_trace("gomory_cut");
enable_trace("gomory_cut_detail");
TRACE("gomory_cut",
TRACE(gomory_cut,
tout << "applying cut at:\n"; print_row(tout, row);
tout << std::endl << "inf_col = " << inf_col << std::endl;
);
@ -231,7 +231,7 @@ struct gomory_test {
if (some_int_columns)
adjust_term_and_k_for_some_ints_case_gomory(t, k, lcm_den);
TRACE("gomory_cut", tout<<"new cut :"; print_term(t, tout); tout << " >= " << k << std::endl;);
TRACE(gomory_cut, tout<<"new cut :"; print_term(t, tout); tout << " >= " << k << std::endl;);
}
};

View file

@ -132,7 +132,7 @@ void test_basic_lemma_for_mon_neutral_from_factors_to_monomial();
void test_cn_on_expr(nex_sum *t, cross_nested &cn) {
t = to_sum(cn.get_nex_creator().simplify(t));
TRACE("nla_test", tout << "t=" << *t << '\n';);
TRACE(nla_test, tout << "t=" << *t << '\n';);
cn.run(t);
}
@ -183,7 +183,7 @@ void test_simplify() {
nex_creator r;
cross_nested cn(
[](const nex *n) {
TRACE("nla_cn_test", tout << *n << "\n";);
TRACE(nla_cn_test, tout << *n << "\n";);
return false;
},
[](unsigned) { return false; }, []() { return 1; }, // for random
@ -203,7 +203,7 @@ void test_simplify() {
auto a_plus_bc = r.mk_sum(a, bc);
auto two_a_plus_bc = r.mk_mul(r.mk_scalar(rational(2)), a_plus_bc);
auto simp_two_a_plus_bc = r.simplify(two_a_plus_bc);
TRACE("nla_test", tout << *simp_two_a_plus_bc << "\n";);
TRACE(nla_test, tout << *simp_two_a_plus_bc << "\n";);
ENSURE(nex_creator::equal(simp_two_a_plus_bc, two_a_plus_bc));
auto simp_a_plus_bc = r.simplify(a_plus_bc);
ENSURE(to_sum(simp_a_plus_bc)->size() > 1);
@ -211,46 +211,46 @@ void test_simplify() {
auto three_ab = r.mk_mul(r.mk_scalar(rational(3)), a, b);
auto three_ab_square = r.mk_mul(three_ab, three_ab, three_ab);
TRACE("nla_test", tout << "before simplify " << *three_ab_square << "\n";);
TRACE(nla_test, tout << "before simplify " << *three_ab_square << "\n";);
three_ab_square = to_mul(r.simplify(three_ab_square));
TRACE("nla_test", tout << *three_ab_square << "\n";);
TRACE(nla_test, tout << *three_ab_square << "\n";);
const rational &s = three_ab_square->coeff();
ENSURE(s == rational(27));
auto m = r.mk_mul(a, a);
TRACE("nla_test_", tout << "m = " << *m << "\n";);
TRACE(nla_test_, tout << "m = " << *m << "\n";);
/*
auto n = r.mk_mul(b, b, b, b, b, b, b);
n->add_child_in_power(b, 7);
n->add_child(r.mk_scalar(rational(3)));
n->add_child_in_power(r.mk_scalar(rational(2)), 2);
n->add_child(r.mk_scalar(rational(1)));
TRACE("nla_test_", tout << "n = " << *n << "\n";);
TRACE(nla_test_, tout << "n = " << *n << "\n";);
m->add_child_in_power(n, 3);
n->add_child_in_power(r.mk_scalar(rational(1, 3)), 2);
TRACE("nla_test_", tout << "m = " << *m << "\n";);
TRACE(nla_test_, tout << "m = " << *m << "\n";);
nex_sum * e = r.mk_sum(a, r.mk_sum(b, m));
TRACE("nla_test", tout << "before simplify e = " << *e << "\n";);
TRACE(nla_test, tout << "before simplify e = " << *e << "\n";);
e = to_sum(r.simplify(e));
TRACE("nla_test", tout << "simplified e = " << *e << "\n";);
TRACE(nla_test, tout << "simplified e = " << *e << "\n";);
ENSURE(e->children().size() > 2);
nex_sum * e_m = r.mk_sum();
for (const nex* ex: to_sum(e)->children()) {
nex* ce = r.mk_mul(r.clone(ex), r.mk_scalar(rational(3)));
TRACE("nla_test", tout << "before simpl ce = " << *ce << "\n";);
TRACE(nla_test, tout << "before simpl ce = " << *ce << "\n";);
ce = r.simplify(ce);
TRACE("nla_test", tout << "simplified ce = " << *ce << "\n";);
TRACE(nla_test, tout << "simplified ce = " << *ce << "\n";);
e_m->add_child(ce);
}
e->add_child(e_m);
TRACE("nla_test", tout << "before simplify sum e = " << *e << "\n";);
TRACE(nla_test, tout << "before simplify sum e = " << *e << "\n";);
e = to_sum(r.simplify(e));
TRACE("nla_test", tout << "simplified sum e = " << *e << "\n";);
TRACE(nla_test, tout << "simplified sum e = " << *e << "\n";);
nex * pr = r.mk_mul(a, b, b);
TRACE("nla_test", tout << "before simplify pr = " << *pr << "\n";);
TRACE(nla_test, tout << "before simplify pr = " << *pr << "\n";);
r.simplify(pr);
TRACE("nla_test", tout << "simplified sum e = " << *pr << "\n";);
TRACE(nla_test, tout << "simplified sum e = " << *pr << "\n";);
*/
#endif
}
@ -260,7 +260,7 @@ void test_cn_shorter() {
// nex_creator cr;
// cross_nested cn(
// [](const nex* n) {
// TRACE("nla_test", tout <<"cn form = " << *n << "\n";
// TRACE(nla_test, tout <<"cn form = " << *n << "\n";
// );
// return false;
@ -295,7 +295,7 @@ void test_cn_shorter() {
// rational(3); nex* _6aad = cr.mk_mul(cr.mk_scalar(rational(6)), a, a,
// d); clone = to_sum(cr.clone(cr.mk_sum(_6aad, abcd, eae, three_eac)));
// clone = to_sum(cr.simplify(clone));
// TRACE("nla_test", tout << "clone = " << *clone << "\n";);
// TRACE(nla_test, tout << "clone = " << *clone << "\n";);
// // test_cn_on_expr(cr.mk_sum(aad, abcd, aaccd, add, eae, eac, ed),
// cn); test_cn_on_expr(clone, cn);
// */
@ -307,7 +307,7 @@ void test_cn() {
// nex_creator cr;
// cross_nested cn(
// [](const nex* n) {
// TRACE("nla_test", tout <<"cn form = " << *n << "\n";);
// TRACE(nla_test, tout <<"cn form = " << *n << "\n";);
// return false;
// } ,
// [](unsigned) { return false; },
@ -352,14 +352,14 @@ void test_cn() {
// nex* _6aad = cr.mk_mul(cr.mk_scalar(rational(6)), a, a, d);
// nex * clone = cr.clone(cr.mk_sum(_6aad, abcd, aaccd, add, eae, eac,
// ed)); clone = cr.simplify(clone); ENSURE(cr.is_simplified(clone));
// TRACE("nla_test", tout << "clone = " << *clone << "\n";);
// TRACE(nla_test, tout << "clone = " << *clone << "\n";);
// // test_cn_on_expr(cr.mk_sum(aad, abcd, aaccd, add, eae, eac, ed),
// cn); test_cn_on_expr(to_sum(clone), cn); TRACE("nla_test", tout <<
// cn); test_cn_on_expr(to_sum(clone), cn); TRACE(nla_test, tout <<
// "done\n";); test_cn_on_expr(cr.mk_sum(abd, abc, cbd, acd), cn);
// TRACE("nla_test", tout << "done\n";);*/
// TRACE(nla_test, tout << "done\n";);*/
// #endif
// // test_cn_on_expr(a*b*b*d*d + a*b*b*c*d + c*b*b*d);
// // TRACE("nla_test", tout << "done\n";);
// // TRACE(nla_test, tout << "done\n";);
// // test_cn_on_expr(a*b*d + a*b*c + c*b*d);
}

View file

@ -154,7 +154,7 @@ void create_abcde(solver & nla,
void test_basic_lemma_for_mon_neutral_from_factors_to_monomial_0() {
std::cout << "test_basic_lemma_for_mon_neutral_from_factors_to_monomial_0\n";
enable_trace("nla_solver");
TRACE("nla_solver",);
TRACE(nla_solver,);
lp::lar_solver s;
unsigned a = 0, b = 1, c = 2, d = 3, e = 4,
abcde = 5, ac = 6, bde = 7;
@ -233,7 +233,7 @@ void s_set_column_value_test(lp::lar_solver&s, lpvar j, const lp::impq & v) {
void test_basic_lemma_for_mon_neutral_from_factors_to_monomial_1() {
std::cout << "test_basic_lemma_for_mon_neutral_from_factors_to_monomial_1\n";
TRACE("nla_solver",);
TRACE(nla_solver,);
lp::lar_solver s;
unsigned a = 0, b = 1, c = 2, d = 3, e = 4,
bde = 7;

View file

@ -115,12 +115,12 @@ static void tst7() {
m.display_smt2(std::cout, a); std::cout << "\n";
}
// if (!qm.le(qa, qt)) { TRACE("mpff_bug", tout << fa << "\n" << qa << "\n" << qt << "\n";); UNREACHABLE(); }
// if (!qm.le(qa, qt)) { TRACE(mpff_bug, tout << fa << "\n" << qa << "\n" << qt << "\n";); UNREACHABLE(); }
#define MK_BIN_OP(OP) \
static void tst_ ## OP ## _core(int64_t n1, uint64_t d1, int64_t n2, uint64_t d2, unsigned precision = 2, unsigned exp = 0) { \
TRACE("mpff_bug", tout << n1 << "/" << d1 << ", " << n2 << "/" << d2 << "\n";); \
TRACE(mpff_bug, tout << n1 << "/" << d1 << ", " << n2 << "/" << d2 << "\n";); \
unsynch_mpq_manager qm; \
scoped_mpq qa(qm), qb(qm), qc(qm), qt(qm); \
\

View file

@ -149,7 +149,7 @@ void tst_div2k(synch_mpz_manager & m, mpz const & v, unsigned k) {
m.machine_div(v, pw, y);
bool is_eq = m.eq(x, y);
(void)is_eq;
CTRACE("mpz_2k", !is_eq, tout << "div: " << m.to_string(v) << ", k: " << k << " r: " << m.to_string(x) << ", expected: " << m.to_string(y) << "\n";);
CTRACE(mpz_2k, !is_eq, tout << "div: " << m.to_string(v) << ", k: " << k << " r: " << m.to_string(x) << ", expected: " << m.to_string(y) << "\n";);
ENSURE(is_eq);
m.del(x);
m.del(y);
@ -177,7 +177,7 @@ void tst_mul2k(synch_mpz_manager & m, mpz const & v, unsigned k) {
m.mul(v, pw, y);
bool is_eq = m.eq(x, y);
(void)is_eq;
CTRACE("mpz_2k", !is_eq, tout << "mul: " << m.to_string(v) << ", k: " << k << " r: " << m.to_string(x) << ", expected: " << m.to_string(y) << "\n";);
CTRACE(mpz_2k, !is_eq, tout << "mul: " << m.to_string(v) << ", k: " << k << " r: " << m.to_string(x) << ", expected: " << m.to_string(y) << "\n";);
ENSURE(is_eq);
m.del(x);
m.del(y);

View file

@ -93,7 +93,7 @@ Z3_ast mk_max(Z3_context ctx, Z3_sort bv, bool is_signed) {
void test_add(unsigned bvsize, bool is_signed) {
TRACE("no_overflow", tout << "test_add: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";);
TRACE(no_overflow, tout << "test_add: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";);
Z3_config cfg = Z3_mk_config();
Z3_context ctx = Z3_mk_context(cfg);
@ -178,7 +178,7 @@ void test_add(unsigned bvsize, bool is_signed) {
void test_sub(unsigned bvsize, bool is_signed) {
TRACE("no_overflow", tout << "test_sub: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";);
TRACE(no_overflow, tout << "test_sub: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";);
Z3_config cfg = Z3_mk_config();
Z3_context ctx = Z3_mk_context(cfg);
@ -292,7 +292,7 @@ void test_sub(unsigned bvsize, bool is_signed) {
void test_neg(unsigned bvsize) {
TRACE("no_overflow", tout << "test_neg: bvsize = " << bvsize << "\n";);
TRACE(no_overflow, tout << "test_neg: bvsize = " << bvsize << "\n";);
Z3_config cfg = Z3_mk_config();
Z3_context ctx = Z3_mk_context(cfg);
@ -340,7 +340,7 @@ void test_neg(unsigned bvsize) {
void test_mul(unsigned bvsize, bool is_signed) {
TRACE("no_overflow", tout << "test_mul: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";);
TRACE(no_overflow, tout << "test_mul: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";);
Z3_config cfg = Z3_mk_config();
Z3_context ctx = Z3_mk_context(cfg);
@ -446,7 +446,7 @@ void test_mul(unsigned bvsize, bool is_signed) {
void test_div(unsigned bvsize) {
TRACE("no_overflow", tout << "test_div: bvsize = " << bvsize << "\n";);
TRACE(no_overflow, tout << "test_div: bvsize = " << bvsize << "\n";);
Z3_config cfg = Z3_mk_config();
Z3_context ctx = Z3_mk_context(cfg);
@ -571,7 +571,7 @@ Z3_ast Z3_API Z3_mk_bvmul_no_underflow_wrapper(Z3_context ctx, Z3_ast t1, Z3_ast
void test_equiv(Equivalence_params params, unsigned bvsize, bool is_signed) {
TRACE("no_overflow", tout << "test_" << params.name << "_equiv: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";);
TRACE(no_overflow, tout << "test_" << params.name << "_equiv: bvsize = " << bvsize << ", is_signed = " << is_signed << "\n";);
Z3_config cfg = Z3_mk_config();
Z3_context ctx = Z3_mk_context(cfg);

View file

@ -92,7 +92,7 @@ static void tst2() {
if (!object_coeff_pairs.empty()) {
unsigned idx = rand() % object_coeff_pairs.size();
cell * c = object_coeff_pairs[idx].first;
CTRACE("object_allocator", c->m_coeff != rational(object_coeff_pairs[idx].second), tout << c->m_coeff << " != " << rational(object_coeff_pairs[idx].second) << "\n";);
CTRACE(object_allocator, c->m_coeff != rational(object_coeff_pairs[idx].second), tout << c->m_coeff << " != " << rational(object_coeff_pairs[idx].second) << "\n";);
ENSURE(c->m_coeff == rational(object_coeff_pairs[idx].second));
if (idx < 5)
m1.recycle(c);
@ -110,13 +110,13 @@ static void tst2() {
num_resets++;
}
}
TRACE("object_allocator", tout << "num. resets: " << num_resets << "\n";);
TRACE(object_allocator, tout << "num. resets: " << num_resets << "\n";);
}
void tst_object_allocator() {
tst1();
tst2();
TRACE("object_allocator", tout << "num. allocated cells: " << cell::g_num_allocated_cells << "\nnum. deallocated cells: " << cell::g_num_deallocated_cells <<
TRACE(object_allocator, tout << "num. allocated cells: " << cell::g_num_allocated_cells << "\nnum. deallocated cells: " << cell::g_num_deallocated_cells <<
"\nnum. recycled cells: " << cell::g_num_recycled_cells << "\n";);
ENSURE(cell::g_num_allocated_cells == cell::g_num_deallocated_cells);
}

View file

@ -28,7 +28,7 @@ static void tst1() {
v = 10;
ENSURE(v);
ENSURE(*v == 10);
TRACE("optional", tout << sizeof(v) << "\n";);
TRACE(optional, tout << sizeof(v) << "\n";);
}
struct OptFoo {
@ -36,11 +36,11 @@ struct OptFoo {
int m_y;
OptFoo(int x, int y):m_x(x), m_y(y) {
TRACE("optional", tout << "OptFoo created: " << m_x << " : " << m_y << "\n";);
TRACE(optional, tout << "OptFoo created: " << m_x << " : " << m_y << "\n";);
}
~OptFoo() {
TRACE("optional", tout << "OptFoo deleted: " << m_x << " : " << m_y << "\n";);
TRACE(optional, tout << "OptFoo deleted: " << m_x << " : " << m_y << "\n";);
}
};
@ -53,7 +53,7 @@ static void tst2() {
v = OptFoo(200, 300);
ENSURE(v->m_x == 200);
ENSURE(v->m_y == 300);
TRACE("optional", tout << sizeof(v) << "\n";);
TRACE(optional, tout << sizeof(v) << "\n";);
}
static void tst3() {
@ -63,7 +63,7 @@ static void tst3() {
v = &x;
ENSURE(v);
ENSURE(*v == &x);
TRACE("optional", tout << sizeof(v) << "\n";);
TRACE(optional, tout << sizeof(v) << "\n";);
ENSURE(*(*v) == 10);
}

View file

@ -49,14 +49,14 @@ static void tst1() {
m.mk(a1);
ENSURE(m.size(a1) == 0);
m.push_back(a1, 10, a2);
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";);
ENSURE(m.size(a1) == 0);
ENSURE(m.size(a2) == 1);
m.push_back(a1, 20, a1);
m.push_back(a1, 30, a1);
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";);
ENSURE(m.get(a1, 0) == 20);
@ -69,7 +69,7 @@ static void tst1() {
ENSURE(m.size(a3) == 2);
ENSURE(m.get(a3, 0) == 10);
ENSURE(m.get(a3, 1) == 100);
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";
m.display_info(tout, a3); tout << "\n";);
@ -77,7 +77,7 @@ static void tst1() {
ENSURE(m.get(a2, 0) == 10);
ENSURE(m.get(a2, 1) == 50);
ENSURE(m.size(a2) == 2);
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";
m.display_info(tout, a3); tout << "\n";);
@ -91,7 +91,7 @@ static void tst2() {
typedef parray_manager<int_parray_config<PRESERVE_ROOTS> > int_parray_manager;
typedef typename int_parray_manager::ref int_array;
TRACE("parray", tout << "tst2\n";);
TRACE(parray, tout << "tst2\n";);
dummy_value_manager<int> vm;
small_object_allocator a;
int_parray_manager m(vm, a);
@ -105,11 +105,11 @@ static void tst2() {
m.push_back(a1, 100, a2);
for (unsigned i = 0; i < 10; i++)
m.push_back(a2, i+101);
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";);
ENSURE(m.get(a1, 0) == 0);
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";);
for (unsigned i = 0; i < m.size(a1); i++) {
@ -118,11 +118,11 @@ static void tst2() {
for (unsigned i = 0; i < m.size(a2); i++) {
ENSURE(static_cast<unsigned>(m.get(a2, i)) == i);
}
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";);
m.unshare(a1);
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";);
m.del(a1);
@ -134,7 +134,7 @@ static void tst3() {
typedef parray_manager<int_parray_config<PRESERVE_ROOTS> > int_parray_manager;
typedef typename int_parray_manager::ref int_array;
TRACE("parray", tout << "tst3\n";);
TRACE(parray, tout << "tst3\n";);
dummy_value_manager<int> vm;
small_object_allocator a;
int_parray_manager m(vm, a);
@ -164,14 +164,14 @@ static void tst3() {
for (unsigned i = 0; i < 20; i++) {
ENSURE(static_cast<unsigned>(m.get(a2, i)) == i+1);
}
TRACE("parray",
TRACE(parray,
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";
m.display_info(tout, a3); tout << "\n";
m.display_info(tout, a4); tout << "\n";
);
ENSURE(m.get(a1, 10) == 10);
TRACE("parray",
TRACE(parray,
tout << "after rerooting...\n";
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";
@ -191,7 +191,7 @@ static void tst3() {
}
ENSURE(m.get(a4, 18) == 30);
ENSURE(m.get(a3, 18) == 40);
TRACE("parray",
TRACE(parray,
tout << "after many gets...\n";
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";
@ -199,7 +199,7 @@ static void tst3() {
m.display_info(tout, a4); tout << "\n";
);
m.unshare(a1);
TRACE("parray",
TRACE(parray,
tout << "after unshare...\n";
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";
@ -207,7 +207,7 @@ static void tst3() {
m.display_info(tout, a4); tout << "\n";
);
m.reroot(a4);
TRACE("parray",
TRACE(parray,
tout << "after reroot...\n";
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";
@ -215,7 +215,7 @@ static void tst3() {
m.display_info(tout, a4); tout << "\n";
);
m.unshare(a2);
TRACE("parray",
TRACE(parray,
tout << "after second unshare...\n";
m.display_info(tout, a1); tout << "\n";
m.display_info(tout, a2); tout << "\n";
@ -244,7 +244,7 @@ typedef parray_manager<expr_array_config> expr_array_manager;
typedef expr_array_manager::ref expr_array;
static void tst4() {
TRACE("parray", tout << "tst4\n";);
TRACE(parray, tout << "tst4\n";);
ast_manager m;
expr_array_manager m2(m, m.get_allocator());
@ -262,12 +262,12 @@ static void tst4() {
m2.push_back(a1, v3);
m2.push_back(a2, v2);
m2.pop_back(a1);
TRACE("parray",
TRACE(parray,
m2.display_info(tout, a1); tout << "\n";
m2.display_info(tout, a2); tout << "\n";
);
m2.reroot(a1);
TRACE("parray",
TRACE(parray,
m2.display_info(tout, a1); tout << "\n";
m2.display_info(tout, a2); tout << "\n";
);

View file

@ -255,9 +255,9 @@ static void tst9() {
q = x2 - (((x0^3) - 1)*(x1^2) - 1);
std::cout << "q: " << q << "\n";
polynomial_ref r2(m);
TRACE("polynomial", tout << "QUASI_RESULTANT: q, sqrt2.....\n";);
TRACE(polynomial, tout << "QUASI_RESULTANT: q, sqrt2.....\n";);
r2 = quasi_resultant(q, sqrt2, 0);
// TRACE("polynomial", tout << "QUASI_RESULTANT: sqrt2, q.....\n";);
// TRACE(polynomial, tout << "QUASI_RESULTANT: sqrt2, q.....\n";);
// std::cout << "r2: " << r2 << "\n";
// r2 = quasi_resultant(sqrt2, q, 0);
// std::cout << "r2: " << r2 << "\n";
@ -1340,7 +1340,7 @@ static void tst_mm() {
static void tst_eval(polynomial_ref const & p, polynomial::var x0, rational v0, polynomial::var x1, rational v1, polynomial::var x2, rational v2,
rational expected) {
TRACE("eval_bug", tout << "tst_eval, " << p << "\n";);
TRACE(eval_bug, tout << "tst_eval, " << p << "\n";);
std::cout << "p: " << p << "\nx" << x0 << " -> " << v0 << "\nx" << x1 << " -> " << v1 << "\nx" << x2 << " -> " << v2 << "\n";
unsynch_mpq_manager qm;
polynomial::simple_var2value<unsynch_mpq_manager> x2v(qm);

View file

@ -135,7 +135,7 @@ private:
#endif
}
TRACE("polynorm",
TRACE(polynorm,
tout << mk_pp(coefficient, m) << "\n";
for (unsigned i = 0; i < factors.size(); ++i) {
tout << mk_pp(factors[i].get(), m) << " * " << mk_pp(coefficients[i].get(), m) << "\n";

View file

@ -22,7 +22,7 @@ Revision History:
static void tst1() {
random_gen r(0);
TRACE("random",
TRACE(random,
for (unsigned i = 0; i < 1000; i++) {
tout << r() << "\n";
});

View file

@ -93,11 +93,11 @@ static void tst1() {
ENSURE(rational(3,4) >= rational(3,4));
ENSURE(rational(3,4) > rational(2,8));
ENSURE(rational(3,4) < rational(7,8));
TRACE("rational", tout << rational(3,4) << "\n";);
TRACE("rational", tout << rational(7,9) << "\n";);
TRACE("rational", tout << rational(-3,7) << "\n";);
TRACE("rational", tout << rational(5,8) << "\n";);
TRACE("rational", tout << rational(4,2) << "\n";);
TRACE(rational, tout << rational(3,4) << "\n";);
TRACE(rational, tout << rational(7,9) << "\n";);
TRACE(rational, tout << rational(-3,7) << "\n";);
TRACE(rational, tout << rational(5,8) << "\n";);
TRACE(rational, tout << rational(4,2) << "\n";);
ENSURE(rational(3) + rational(2) == rational(5));
ENSURE(rational(3) - rational(2) == rational(1));
ENSURE(rational(3) * rational(2) == rational(6));
@ -112,9 +112,9 @@ static void tst2() {
rational r1("10000000000000000000000000000000000");
rational r2("10000000000000000000000000000000000/3");
rational r3("20000000000000000000000000000000000/6");
TRACE("rational", tout << r1 << std::endl;);
TRACE("rational", tout << r2 << std::endl;);
TRACE("rational", tout << r3 << std::endl;);
TRACE(rational, tout << r1 << std::endl;);
TRACE(rational, tout << r2 << std::endl;);
TRACE(rational, tout << r3 << std::endl;);
ENSURE(r2 == r3);
ENSURE(r1 != r2);
@ -207,16 +207,16 @@ static void tst2() {
void tst3() {
rational n1 = power(rational(2), 32);
TRACE("rational", tout << "n1: " << n1 << "\n";);
TRACE(rational, tout << "n1: " << n1 << "\n";);
rational n2 = div(n1, rational(2));
rational n3 = div(rational(2), n2);
TRACE("rational",
TRACE(rational,
tout << "n1: " << n1 << "\n";
tout << "n2: " << n2 << "\n";
tout << "n3: " << n3 << "\n";);
rational n4 = n1 - rational(3);
rational n5 = div(n4, rational(2));
TRACE("rational",
TRACE(rational,
tout << "n4: " << n4 << "\n";
tout << "n5: " << n5 << "\n";);
ENSURE(n5 == rational("2147483646"));
@ -224,7 +224,7 @@ void tst3() {
void tst4() {
rational n1("4294967293");
TRACE("rational", tout << "n1: " << n1 << "\n";);
TRACE(rational, tout << "n1: " << n1 << "\n";);
rational n2 = div(n1, rational(2));
}
@ -233,9 +233,9 @@ void tst5() {
n1.neg();
rational n2("4294967295");
n1 /= n2;
TRACE("rational", tout << n1 << " " << n2 << " " << n1.is_big() << " " << n2.is_big() << "\n";);
TRACE(rational, tout << n1 << " " << n2 << " " << n1.is_big() << " " << n2.is_big() << "\n";);
n1 *= n2;
TRACE("rational", tout << "after: " << n1 << " " << n2 << "\n";);
TRACE(rational, tout << "after: " << n1 << " " << n2 << "\n";);
ENSURE(n1.is_minus_one());
}
@ -305,7 +305,7 @@ static void tst7() {
rational y;
rational gcd;
extended_gcd(n, p, gcd, x, y);
TRACE("gcd", tout << n << " " << p << ": " << gcd << " " << x << " " << y << "\n";);
TRACE(gcd, tout << n << " " << p << ": " << gcd << " " << x << " " << y << "\n";);
ENSURE(!mod(n, rational(2)).is_one() || mod(n * x, p).is_one());
}
}
@ -490,7 +490,7 @@ static void tst13() {
void tst_rational() {
TRACE("rational", tout << "starting rational test...\n";);
TRACE(rational, tout << "starting rational test...\n";);
std::cout << "sizeof(rational): " << sizeof(rational) << "\n";
rational r1("10000000000000000000000000000000001");
r1.hash();

View file

@ -36,28 +36,28 @@ void tst_simple_parser() {
p.add_var("y");
expr_ref r(m);
p.parse_string("(+ x (* y x))", r);
TRACE("simple_parser", tout << mk_pp(r, m) << "\n";);
TRACE(simple_parser, tout << mk_pp(r, m) << "\n";);
p.parse_string("(+ x (* y x) x)", r);
float vals[2] = { 2.0f, 3.0f };
(void)vals;
TRACE("simple_parser",
TRACE(simple_parser,
tout << mk_pp(r, m) << "\n";
tout << "val: " << eval(r, 2, vals) << "\n";);
p.parse_string("(+ x (* y x) x", r); // << error
p.parse_string("(x)", r); // << error
p.parse_string("(+ x))", r); // <<< this is accepted
TRACE("simple_parser", tout << mk_pp(r, m) << "\n";);
TRACE(simple_parser, tout << mk_pp(r, m) << "\n";);
p.parse_string(")x)", r); // error
p.parse_string("(+ x (* 10 y) 2)", r);
TRACE("simple_parser",
TRACE(simple_parser,
tout << mk_pp(r, m) << "\n";
tout << "val: " << eval(r, 2, vals) << "\n";);
p.parse_string("(ite (and (> x 3) (<= y 4)) 2 10)", r);
TRACE("simple_parser",
TRACE(simple_parser,
tout << mk_pp(r, m) << "\n";
tout << "val: " << eval(r, 2, vals) << "\n";);
p.parse_string("(ite (or (> x 3) (<= y 4)) 2 10)", r);
TRACE("simple_parser",
TRACE(simple_parser,
tout << mk_pp(r, m) << "\n";
tout << "val: " << eval(r, 2, vals) << "\n";);
}

View file

@ -13,7 +13,7 @@ Copyright (c) 2015 Microsoft Corporation
static void ev_const(Z3_context ctx, Z3_ast e) {
Z3_ast r = Z3_simplify(ctx, e);
TRACE("simplifier",
TRACE(simplifier,
tout << Z3_ast_to_string(ctx, e) << " -> ";
tout << Z3_ast_to_string(ctx, r) << "\n";);
Z3_ast_kind k = Z3_get_ast_kind(ctx, r);
@ -34,7 +34,7 @@ static void test_bv() {
Z3_ast e = Z3_mk_eq(ctx, bit3_2, Z3_mk_sign_ext(ctx, 1, bit1_1));
ENSURE(Z3_simplify(ctx, e) == Z3_mk_true(ctx));
TRACE("simplifier", tout << Z3_ast_to_string(ctx, e) << "\n";);
TRACE(simplifier, tout << Z3_ast_to_string(ctx, e) << "\n";);
Z3_ast b12 = Z3_mk_numeral(ctx, "12", bv72);
Z3_ast b13 = Z3_mk_numeral(ctx, "13", bv72);
@ -149,8 +149,8 @@ static void test_bool() {
Z3_ast b = Z3_simplify(ctx, Z3_mk_not(ctx, Z3_mk_iff(ctx, Z3_mk_false(ctx), Z3_mk_true(ctx))));
ENSURE(Z3_mk_true(ctx) == a);
ENSURE(Z3_mk_true(ctx) == b);
TRACE("simplifier", tout << Z3_ast_to_string(ctx, a) << "\n";);
TRACE("simplifier", tout << Z3_ast_to_string(ctx, b) << "\n";);
TRACE(simplifier, tout << Z3_ast_to_string(ctx, a) << "\n";);
TRACE(simplifier, tout << Z3_ast_to_string(ctx, b) << "\n";);
Z3_del_config(cfg);
Z3_del_context(ctx);
@ -179,8 +179,8 @@ static void test_array() {
Z3_ast rxy = Z3_simplify(ctx, exy);
(void)rxy;
TRACE("simplifier", tout << Z3_ast_to_string(ctx, rxy) << "\n";);
TRACE("simplifier", tout << Z3_ast_to_string(ctx, Z3_simplify(ctx, Z3_mk_eq(ctx, x2, x3))) << "\n";);
TRACE(simplifier, tout << Z3_ast_to_string(ctx, rxy) << "\n";);
TRACE(simplifier, tout << Z3_ast_to_string(ctx, Z3_simplify(ctx, Z3_mk_eq(ctx, x2, x3))) << "\n";);
// ENSURE(rxy == Z3_mk_true(ctx));
// ENSURE(Z3_simplify(ctx, Z3_mk_eq(ctx, x2, x3)) == Z3_mk_false(ctx));
@ -189,7 +189,7 @@ static void test_array() {
exy = Z3_mk_eq(ctx, xs[i], xs[j]);
rxy = Z3_simplify(ctx, exy);
TRACE("simplifier",
TRACE(simplifier,
tout << Z3_ast_to_string(ctx, exy);
tout << " -> " << Z3_ast_to_string(ctx, rxy) << "\n";
);
@ -201,7 +201,7 @@ static void test_array() {
(void)sel1;
(void)sel2;
TRACE("simplifier",
TRACE(simplifier,
tout << Z3_ast_to_string(ctx, Z3_simplify(ctx, sel1)) << "\n";
tout << Z3_ast_to_string(ctx, Z3_simplify(ctx, sel2)) << "\n";
);

View file

@ -15,20 +15,20 @@ void tst_small_object_allocator() {
char * p1 = new (soa) char[13];
char * q1 = new (soa) char[14];
char * p2 = new (soa) char[13];
TRACE("small_object_allocator",
TRACE(small_object_allocator,
tout << "p1: " << (void*)p1 << " q1: " << (void*)q1 << " p2: " << (void*)p2 << "\n";);
soa.deallocate(13,p1);
soa.deallocate(14,q1);
soa.deallocate(13,p2);
char * p3 = new (soa) char[13];
TRACE("small_object_allocator", tout << "p3: " << (void*)p3 << "\n";);
TRACE(small_object_allocator, tout << "p3: " << (void*)p3 << "\n";);
soa.deallocate(13,p3);
char * r1 = new (soa) char[1];
char * r2 = new (soa) char[1];
char * r3 = new (soa) char[1];
char * r4 = new (soa) char[1];
TRACE("small_object_allocator",
TRACE(small_object_allocator,
tout << "r1: " << (void*)r1 << " r2: " << (void*)r2 << " r3: " << (void*)r3 << " r4: " << (void*)r4 << "\n";);
soa.deallocate(1,r1);
@ -37,7 +37,7 @@ void tst_small_object_allocator() {
soa.deallocate(1,r4);
r4 = new (soa) char[1];
r3 = new (soa) char[1];
TRACE("small_object_allocator",
TRACE(small_object_allocator,
tout << "r1: " << (void*)r1 << " r2: " << (void*)r2 << " r3: " << (void*)r3 << " r4: " << (void*)r4 << "\n";);
soa.deallocate(1,r1);
soa.deallocate(1,r2);

View file

@ -219,7 +219,7 @@ static void test_eq1(unsigned n, sorting_network_encoding enc) {
model_ref model;
solver.get_model(model);
model_smt2_pp(std::cout, m, *model, 0);
TRACE("pb", model_smt2_pp(tout, m, *model, 0););
TRACE(pb, model_smt2_pp(tout, m, *model, 0););
}
ENSURE(l_false == res);
ext.m_clauses.reset();
@ -267,7 +267,7 @@ static void test_sorting_eq(unsigned n, unsigned k, sorting_network_encoding enc
solver.assert_expr(in[k].get());
res = solver.check();
if (res == l_true) {
TRACE("pb",
TRACE(pb,
unsigned sz = solver.size();
for (unsigned i = 0; i < sz; ++i) {
tout << mk_pp(solver.get_formula(i), m) << "\n";
@ -275,7 +275,7 @@ static void test_sorting_eq(unsigned n, unsigned k, sorting_network_encoding enc
model_ref model;
solver.get_model(model);
model_smt2_pp(std::cout, m, *model, 0);
TRACE("pb", model_smt2_pp(tout, m, *model, 0););
TRACE(pb, model_smt2_pp(tout, m, *model, 0););
}
ENSURE(res == l_false);
solver.pop(1);
@ -324,7 +324,7 @@ static void test_sorting_le(unsigned n, unsigned k, sorting_network_encoding enc
solver.assert_expr(in[k].get());
res = solver.check();
if (res == l_true) {
TRACE("pb",
TRACE(pb,
unsigned sz = solver.size();
for (unsigned i = 0; i < sz; ++i) {
tout << mk_pp(solver.get_formula(i), m) << "\n";
@ -332,7 +332,7 @@ static void test_sorting_le(unsigned n, unsigned k, sorting_network_encoding enc
model_ref model;
solver.get_model(model);
model_smt2_pp(std::cout, m, *model, 0);
TRACE("pb", model_smt2_pp(tout, m, *model, 0););
TRACE(pb, model_smt2_pp(tout, m, *model, 0););
}
ENSURE(res == l_false);
solver.pop(1);
@ -373,7 +373,7 @@ void test_sorting_ge(unsigned n, unsigned k, sorting_network_encoding enc) {
solver.assert_expr(m.mk_not(in[n - k].get()));
res = solver.check();
if (res == l_true) {
TRACE("pb",
TRACE(pb,
unsigned sz = solver.size();
for (unsigned i = 0; i < sz; ++i) {
tout << mk_pp(solver.get_formula(i), m) << "\n";
@ -381,7 +381,7 @@ void test_sorting_ge(unsigned n, unsigned k, sorting_network_encoding enc) {
model_ref model;
solver.get_model(model);
model_smt2_pp(std::cout, m, *model, 0);
TRACE("pb", model_smt2_pp(tout, m, *model, 0););
TRACE(pb, model_smt2_pp(tout, m, *model, 0););
}
ENSURE(res == l_false);
solver.pop(1);

View file

@ -33,7 +33,7 @@ static void tst2() {
int r = rand() % 10;
b << r;
}
TRACE("string_buffer", tout << b.c_str() << "\n";);
TRACE(string_buffer, tout << b.c_str() << "\n";);
ENSURE(strlen(b.c_str()) == 10000);
}

View file

@ -41,11 +41,11 @@ void tst_substitution()
expr_ref res(m);
TRACE("substitution", subst.display(tout););
TRACE("substitution", tout << ok1 << " " << ok2 << "\n";);
TRACE(substitution, subst.display(tout););
TRACE(substitution, tout << ok1 << " " << ok2 << "\n";);
subst.display(std::cout);
subst.apply(v1.get(), res);
TRACE("substitution", tout << mk_pp(res, m) << "\n";);
TRACE(substitution, tout << mk_pp(res, m) << "\n";);
expr_ref q(m), body(m);
sort_ref_vector sorts(m);
@ -55,6 +55,6 @@ void tst_substitution()
body = m.mk_and(m.mk_eq(v1,v2), m.mk_eq(v3,v4));
q = m.mk_forall(sorts.size(), sorts.data(), names.data(), body);
subst.apply(q, res);
TRACE("substitution", tout << mk_pp(q, m) << "\n->\n" << mk_pp(res, m) << "\n";);
TRACE(substitution, tout << mk_pp(q, m) << "\n->\n" << mk_pp(res, m) << "\n";);
}

View file

@ -138,7 +138,7 @@ void tst_theory_pb() {
unsigned k = populate_literals(i, lits);
std::cout << "k:" << k << " " << N << "\n";
std::cout.flush();
TRACE("pb", tout << "k " << k << ": " << lits << "\n";);
TRACE(pb, tout << "k " << k << ": " << lits << "\n";);
{
smt::context ctx(m, params);
@ -146,7 +146,7 @@ void tst_theory_pb() {
smt::literal l = smt::theory_pb::assert_ge(ctx, k+1, lits.size(), lits.data());
if (l != smt::false_literal) {
ctx.assign(l, nullptr, false);
TRACE("pb", tout << "assign: " << l << "\n";
TRACE(pb, tout << "assign: " << l << "\n";
ctx.display(tout););
VERIFY(l_false == ctx.check());
}
@ -158,7 +158,7 @@ void tst_theory_pb() {
smt::literal l = smt::theory_pb::assert_ge(ctx, k, lits.size(), lits.data());
ENSURE(l != smt::false_literal);
ctx.assign(l, nullptr, false);
TRACE("pb", ctx.display(tout););
TRACE(pb, ctx.display(tout););
VERIFY(l_true == ctx.check());
ctx.pop(1);
}

View file

@ -110,7 +110,7 @@ static void tst_float_sine(std::ostream & out, unsigned N, unsigned k) {
for (unsigned i = 0; i < N; i++) {
unsigned n = 4 * (rand() % PREC);
unsigned d = PREC;
TRACE("sine", tout << "next-val : " << n << "/" << d << "\n";);
TRACE(sine, tout << "next-val : " << n << "/" << d << "\n";);
fm.set(a, EBITS, SBITS, MPF_ROUND_TOWARD_POSITIVE, n, d);
if (rand() % 2 == 0)
fm.neg(a);

View file

@ -123,7 +123,7 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana
um.eval_sign_at(q.size(), q.data(), uppers[i]) == 0 ||
um.sign_variations_at(sseq, lowers[i]) - um.sign_variations_at(sseq, uppers[i]) == 1);
// Fourier sequence may also be used to check if the interval is isolating
TRACE("upolynomial",
TRACE(upolynomial,
tout << "lowers[i]: " << bqm.to_string(lowers[i]) << "\n";
tout << "uppers[i]: " << bqm.to_string(uppers[i]) << "\n";
tout << "fourier lower: " << um.sign_variations_at(fseq, lowers[i]) << "\n";
@ -140,7 +140,7 @@ static void tst_isolate_roots(polynomial_ref const & p, unsigned prec, mpbq_mana
// Double checking using Descartes bounds for the interval
// Must use square free component.
unsigned dab = um.descartes_bound_a_b(q_sqf.size(), q_sqf.data(), bqm, lowers[i], uppers[i]);
TRACE("upolynomial", tout << "Descartes bound: " << dab << "\n";);
TRACE(upolynomial, tout << "Descartes bound: " << dab << "\n";);
VERIFY(dab == 1);
}
}
@ -896,7 +896,7 @@ static void tst_fact(polynomial_ref const & p, unsigned num_distinct_factors, up
ENSURE(fs.distinct_factors() == num_distinct_factors);
upolynomial::scoped_numeral_vector _r(um);
fs.multiply(_r);
TRACE("upolynomial", tout << "_r: "; um.display(tout, _r); tout << "\n_p: "; um.display(tout, _p); tout << "\n";);
TRACE(upolynomial, tout << "_r: "; um.display(tout, _r); tout << "\n_p: "; um.display(tout, _p); tout << "\n";);
ENSURE(um.eq(_p, _r));
}

View file

@ -52,7 +52,7 @@ void tst_instantiate(ast_manager & m, expr * f) {
for (unsigned i = 0; i < q->get_num_decls(); i++)
cnsts.push_back(m.mk_fresh_const("a", q->get_decl_sort(i)));
expr_ref r = instantiate(m, q, cnsts.data());
TRACE("var_subst", tout << "quantifier:\n" << mk_pp(q, m) << "\nresult:\n" << mk_pp(r, m) << "\n";);
TRACE(var_subst, tout << "quantifier:\n" << mk_pp(q, m) << "\nresult:\n" << mk_pp(r, m) << "\n";);
}
}