3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

test hilbert-basis with fdds and checked integers

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2013-03-26 17:31:11 -07:00
parent b1fc6a5cac
commit 00e79e6b6b
11 changed files with 969 additions and 83 deletions

87
src/test/fdd.cpp Normal file
View file

@ -0,0 +1,87 @@
#include "fdd.h"
static void test1() {
fdd::manager m;
m.reset(2);
int64 keys1[2] = { 1, 2 };
m.insert(keys1);
m.display(std::cout << "test1\n");
}
static void test2() {
fdd::manager m;
m.reset(2);
int64 keys2[2] = { 2, 1 };
m.insert(keys2);
m.display(std::cout << "test2\n");
}
static void test3() {
fdd::manager m;
m.reset(2);
int64 keys1[2] = { 1, 2 };
int64 keys2[2] = { 2, 1 };
m.insert(keys1);
m.insert(keys2);
m.display(std::cout << "test3\n");
}
static void test4() {
fdd::manager m;
std::cout << "test4\n";
m.reset(2);
int64 keys1[2] = { 1, 2 };
int64 keys2[2] = { 2, 1 };
int64 keys3[2] = { 1, 1 };
int64 keys4[2] = { 2, 2 };
int64 keys5[2] = { 2, 3 };
int64 keys6[2] = { 3, 1 };
int64 keys7[2] = { 3, 4 };
m.insert(keys1);
m.insert(keys2);
std::cout << m.find_le(keys1) << "\n";
std::cout << m.find_le(keys2) << "\n";
std::cout << m.find_le(keys3) << "\n";
std::cout << m.find_le(keys4) << "\n";
std::cout << m.find_le(keys5) << "\n";
std::cout << m.find_le(keys6) << "\n";
std::cout << m.find_le(keys7) << "\n";
SASSERT(m.find_le(keys1));
SASSERT(m.find_le(keys2));
SASSERT(!m.find_le(keys3));
SASSERT(m.find_le(keys4));
SASSERT(m.find_le(keys5));
SASSERT(m.find_le(keys6));
SASSERT(m.find_le(keys7));
}
static void test5() {
fdd::manager m;
std::cout << "test5\n";
m.reset(2);
int64 keys1[2] = { 1, 2 };
int64 keys2[2] = { 2, 1 };
m.insert(keys1);
m.insert(keys2);
m.insert(keys2);
m.display(std::cout);
}
void tst_fdd() {
test1();
test2();
test3();
test4();
test5();
}

View file

@ -27,7 +27,8 @@ static void find_le(heap_trie_t& ht, unsigned num_keys, unsigned const* keys) {
void tst_heap_trie() {
heap_trie_t ht;
unsigned_le le;
heap_trie_t ht(le);
ht.reset(3);
unsigned keys1[3] = { 1, 2, 3};

View file

@ -508,6 +508,12 @@ static void tst15() {
saturate_basis(hb);
}
static void tst16() {
hilbert_basis hb;
hb.add_le(vec(1, 0), R(100));
saturate_basis(hb);
}
void tst_hilbert_basis() {
std::cout << "hilbert basis test\n";
@ -537,6 +543,7 @@ void tst_hilbert_basis() {
tst13();
tst14();
tst15();
tst16();
gorrila_test(0, 4, 3, 20, 5);
gorrila_test(1, 4, 3, 20, 5);
//gorrila_test(2, 4, 3, 20, 5);

View file

@ -210,6 +210,7 @@ int main(int argc, char ** argv) {
TST(hilbert_basis);
TST(heap_trie);
TST(karr);
TST(fdd);
}
void initialize_mam() {}