3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-05 00:20:50 +00:00

ensure engine is datalog for dl_table and dl_util tests

This commit is contained in:
Nikolaj Bjorner 2026-05-31 15:32:23 -07:00
parent 24e5a6ae3f
commit ebdf031c8f
6 changed files with 16 additions and 15 deletions

View file

@ -777,7 +777,7 @@ namespace datalog {
datatype_util dt; datatype_util dt;
bv_util bv; bv_util bv;
array_util ar; array_util ar;
DL_ENGINE m_engine_type; DL_ENGINE m_engine_type = DATALOG_ENGINE;
bool is_large_bv(expr *e) { bool is_large_bv(expr *e) {
sort *s = e->get_sort(); sort *s = e->get_sort();
@ -961,7 +961,6 @@ namespace datalog {
if (get_engine() == DATALOG_ENGINE) { if (get_engine() == DATALOG_ENGINE) {
m_rel = dynamic_cast<rel_context_base*>(m_engine.get()); m_rel = dynamic_cast<rel_context_base*>(m_engine.get());
} }
} }
} }

View file

@ -192,7 +192,7 @@ namespace datalog {
model_converter_ref m_mc; model_converter_ref m_mc;
proof_converter_ref m_pc; proof_converter_ref m_pc;
rel_context_base* m_rel; rel_context_base* m_rel = nullptr;
scoped_ptr<engine_base> m_engine; scoped_ptr<engine_base> m_engine;
bool m_closed; bool m_closed;
@ -201,7 +201,7 @@ namespace datalog {
execution_result m_last_status; execution_result m_last_status;
expr_ref m_last_answer; expr_ref m_last_answer;
expr_ref m_last_ground_answer; expr_ref m_last_ground_answer;
DL_ENGINE m_engine_type; DL_ENGINE m_engine_type = LAST_ENGINE;

View file

@ -23,10 +23,13 @@ static void test_table(mk_table_fn mk_table) {
sig.push_back(8); sig.push_back(8);
sig.push_back(4); sig.push_back(4);
smt_params params; smt_params params;
params_ref fp_params;
gparams::set("fp.engine", "datalog");
// fp_params.set_sym("fp.engine", symbol("datalog"));
ast_manager ast_m; ast_manager ast_m;
reg_decl_plugins(ast_m); reg_decl_plugins(ast_m);
datalog::register_engine re; datalog::register_engine re;
datalog::context ctx(ast_m, re, params); datalog::context ctx(ast_m, re, params, fp_params);
datalog::relation_manager & m = ctx.get_rel_context()->get_rmanager(); datalog::relation_manager & m = ctx.get_rel_context()->get_rmanager();
m.register_plugin(alloc(datalog::bitvector_table_plugin, m)); m.register_plugin(alloc(datalog::bitvector_table_plugin, m));
@ -48,13 +51,10 @@ static void test_table(mk_table_fn mk_table) {
table.add_fact(row2); table.add_fact(row2);
table.display(std::cout); table.display(std::cout);
datalog::table_base::iterator it = table.begin(); for (auto &r : table) {
datalog::table_base::iterator end = table.end(); r.get_fact(row);
for (; it != end; ++it) { for (auto v : row)
it->get_fact(row); std::cout << v << " ";
for (unsigned j = 0; j < row.size(); ++j) {
std::cout << row[j] << " ";
}
std::cout << "\n"; std::cout << "\n";
} }

View file

@ -49,6 +49,7 @@ void dl_util_cycle_from_permutation() {
} }
void tst_dl_util() { void tst_dl_util() {
gparams::set("fp.engine", "datalog");
dl_util_two_array_sort(); dl_util_two_array_sort();
dl_util_cycle_from_permutation(); dl_util_cycle_from_permutation();
} }

View file

@ -436,7 +436,7 @@ public:
//sub:{xxx \ {1x0, 0x1}} //sub:{xxx \ {1x0, 0x1}}
//result:{100} //result:{100}
for (unsigned i = 0; i < 1000; ++i) { for (unsigned i = 0; i < 100; ++i) {
udoc d1, d2; udoc d1, d2;
mk_rand_udoc(3, 3, d1); mk_rand_udoc(3, 3, d1);
mk_rand_udoc(3, 3, d2); mk_rand_udoc(3, 3, d2);
@ -453,7 +453,7 @@ public:
void test_intersect() { void test_intersect() {
expr_ref fml1(m), fml2(m), fml3(m); expr_ref fml1(m), fml2(m), fml3(m);
for (unsigned i = 0; i < 10000; ++i) { for (unsigned i = 0; i < 100; ++i) {
udoc d1, d2; udoc d1, d2;
mk_rand_udoc(3, 3, d1); mk_rand_udoc(3, 3, d1);
mk_rand_udoc(3, 3, d2); mk_rand_udoc(3, 3, d2);

View file

@ -44,6 +44,7 @@ class udoc_tester {
bv_util bv; bv_util bv;
expr_ref_vector m_vars; expr_ref_vector m_vars;
smt_params m_smt_params; smt_params m_smt_params;
params_ref m_fp_params;
datalog::register_engine m_reg; datalog::register_engine m_reg;
datalog::context m_ctx; datalog::context m_ctx;
datalog::rel_context rc; datalog::rel_context rc;
@ -113,7 +114,7 @@ class udoc_tester {
public: public:
udoc_tester(): udoc_tester():
m_init(m), bv(m), m_vars(m), m_ctx(m, m_reg, m_smt_params), rc(m_ctx), m_init(m), bv(m), m_vars(m), m_ctx(m, m_reg, m_smt_params, m_fp_params), rc(m_ctx),
p(dynamic_cast<udoc_plugin&>(*rc.get_rmanager().get_relation_plugin(symbol("doc")))), p(dynamic_cast<udoc_plugin&>(*rc.get_rmanager().get_relation_plugin(symbol("doc")))),
cr(dynamic_cast<datalog::check_relation_plugin&>(*rc.get_rmanager().get_relation_plugin(symbol("check_relation")))) cr(dynamic_cast<datalog::check_relation_plugin&>(*rc.get_rmanager().get_relation_plugin(symbol("check_relation"))))
{ {