mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
value sweep
This commit is contained in:
parent
38e0968845
commit
19409a25a6
6 changed files with 271 additions and 0 deletions
|
@ -123,6 +123,7 @@ add_executable(test-z3
|
|||
uint_set.cpp
|
||||
upolynomial.cpp
|
||||
value_generator.cpp
|
||||
value_sweep.cpp
|
||||
var_subst.cpp
|
||||
vector.cpp
|
||||
lp/lp.cpp
|
||||
|
|
|
@ -218,6 +218,7 @@ int main(int argc, char ** argv) {
|
|||
TST(ext_numeral);
|
||||
TST(interval);
|
||||
TST(value_generator);
|
||||
TST(value_sweep);
|
||||
TST(vector);
|
||||
TST(f2n);
|
||||
TST(hwf);
|
||||
|
|
37
src/test/value_sweep.cpp
Normal file
37
src/test/value_sweep.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#include "ast/rewriter/value_sweep.h"
|
||||
#include "ast/reg_decl_plugins.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/seq_decl_plugin.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
|
||||
void tst_value_sweep() {
|
||||
ast_manager m;
|
||||
reg_decl_plugins(m);
|
||||
datatype_util dt(m);
|
||||
arith_util a(m);
|
||||
array_util ar(m);
|
||||
seq_util seq(m);
|
||||
sort_ref int_sort(a.mk_int(), m);
|
||||
func_decl_ref cons(m), is_cons(m), head(m), tail(m), nil(m), is_nil(m);
|
||||
|
||||
sort_ref ilist = dt.mk_list_datatype(int_sort, symbol("ilist"),
|
||||
cons, is_cons, head, tail, nil, is_nil);
|
||||
|
||||
expr_ref n(m.mk_const("n", int_sort), m);
|
||||
expr_ref v1(m.mk_const("v1", ilist), m);
|
||||
expr_ref v2(m.mk_const("v2", ilist), m);
|
||||
std::cout << cons << "\n";
|
||||
expr_ref v3(m.mk_app(cons.get(), n, v1), m);
|
||||
expr_ref_vector terms(m);
|
||||
terms.push_back(v1).push_back(v2).push_back(v3);
|
||||
vector<expr_ref_vector> values;
|
||||
value_sweep ws(m);
|
||||
ws.set_range(30);
|
||||
ws(terms, values);
|
||||
for (auto const& vec : values) {
|
||||
for (expr* v : vec) {
|
||||
std::cout << mk_pp(v, m) << "\n";
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue