mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
785c9a18ca
commit
9ea1cf3c5c
8 changed files with 497 additions and 4 deletions
|
@ -122,6 +122,7 @@ add_executable(test-z3
|
|||
udoc_relation.cpp
|
||||
uint_set.cpp
|
||||
upolynomial.cpp
|
||||
value_generator.cpp
|
||||
var_subst.cpp
|
||||
vector.cpp
|
||||
lp/lp.cpp
|
||||
|
|
|
@ -217,6 +217,7 @@ int main(int argc, char ** argv) {
|
|||
if (test_all) return 0;
|
||||
TST(ext_numeral);
|
||||
TST(interval);
|
||||
TST(value_generator);
|
||||
TST(vector);
|
||||
TST(f2n);
|
||||
TST(hwf);
|
||||
|
|
59
src/test/value_generator.cpp
Normal file
59
src/test/value_generator.cpp
Normal file
|
@ -0,0 +1,59 @@
|
|||
#include "ast/value_generator.h"
|
||||
#include "ast/reg_decl_plugins.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include "ast/seq_decl_plugin.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
|
||||
static void list(unsigned bound, ast_manager& m, sort* s) {
|
||||
value_generator gen(m);
|
||||
for (unsigned i = 0; i < bound; ++i) {
|
||||
std::cout << gen.get_value(s, i) << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
static void tst1_vg() {
|
||||
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 bool_seq(seq.str.mk_seq(m.mk_bool_sort()), m);
|
||||
list(16, m, bool_seq);
|
||||
return;
|
||||
|
||||
sort_ref ilist = dt.mk_list_datatype(int_sort, symbol("ilist"),
|
||||
cons, is_cons, head, tail, nil, is_nil);
|
||||
list(100, m, ilist);
|
||||
|
||||
sort_ref blist = dt.mk_list_datatype(m.mk_bool_sort(), symbol("blist"),
|
||||
cons, is_cons, head, tail, nil, is_nil);
|
||||
list(100, m, blist);
|
||||
|
||||
sort_ref rlist = dt.mk_list_datatype(a.mk_real(), symbol("rlist"),
|
||||
cons, is_cons, head, tail, nil, is_nil);
|
||||
list(100, m, rlist);
|
||||
|
||||
list(100, m, a.mk_real());
|
||||
list(100, m, a.mk_int());
|
||||
|
||||
sort_ref int_seq(seq.str.mk_seq(a.mk_int()), m);
|
||||
list(100, m, int_seq);
|
||||
|
||||
sort_ref as(m);
|
||||
as = ar.mk_array_sort(a.mk_int(), a.mk_int());
|
||||
list(100, m, as);
|
||||
as = ar.mk_array_sort(m.mk_bool_sort(), a.mk_int());
|
||||
list(100, m, as);
|
||||
as = ar.mk_array_sort(m.mk_bool_sort(), m.mk_bool_sort());
|
||||
list(10, m, as);
|
||||
|
||||
}
|
||||
|
||||
void tst_value_generator() {
|
||||
tst1_vg();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue