3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-02 01:13:18 +00:00

set up test for slicing

This commit is contained in:
Jakob Rath 2023-06-15 11:43:14 +02:00
parent 71ef78fb25
commit 136e819cb9
5 changed files with 24 additions and 4 deletions

View file

@ -198,6 +198,7 @@ namespace polysat {
xs.push_back(x); xs.push_back(x);
} }
} }
SASSERT(ys.empty());
} }
void slicing::find_base(slice src, slice_vector& out_base) const { void slicing::find_base(slice src, slice_vector& out_base) const {

View file

@ -32,6 +32,8 @@ namespace polysat {
class slicing final { class slicing final {
friend class test_slicing;
// solver& m_solver; // solver& m_solver;
#if 0 #if 0
@ -111,16 +113,16 @@ namespace polysat {
// Retrieve (or create) base slices s_1,...,s_n such that src[hi:lo] == s_1 ++ ... ++ s_n // Retrieve (or create) base slices s_1,...,s_n such that src[hi:lo] == s_1 ++ ... ++ s_n
void mk_slice(slice src, unsigned hi, unsigned lo, slice_vector& out_base); void mk_slice(slice src, unsigned hi, unsigned lo, slice_vector& out_base);
// find representative // Find representative
slice_idx find(slice_idx i) const; slice_idx find(slice_idx i) const;
// merge equivalence classes of two base slices // Merge equivalence classes of two base slices
void merge(slice_idx s1, slice_idx s2); void merge(slice_idx s1, slice_idx s2);
// Equality x_1 ++ ... ++ x_n == y_1 ++ ... ++ y_k // Merge equality x_1 ++ ... ++ x_n == y_1 ++ ... ++ y_k
// //
// Precondition: // Precondition:
// - sequence of base slices without holes (TODO: condition on holes probably not necessary? total widths have to match of course) // - sequence of base slices (equal total width)
// - ordered from msb to lsb // - ordered from msb to lsb
// - slices have the same reference point // - slices have the same reference point
void merge(slice_vector& xs, slice_vector& ys); void merge(slice_vector& xs, slice_vector& ys);

View file

@ -109,6 +109,7 @@ add_executable(test-z3
simple_parser.cpp simple_parser.cpp
simplex.cpp simplex.cpp
simplifier.cpp simplifier.cpp
slicing.cpp
small_object_allocator.cpp small_object_allocator.cpp
smt2print_parse.cpp smt2print_parse.cpp
smt_context.cpp smt_context.cpp

View file

@ -267,6 +267,7 @@ int main(int argc, char ** argv) {
TST(fixplex); TST(fixplex);
TST(mod_interval); TST(mod_interval);
TST(viable); TST(viable);
TST(slicing);
TST(totalizer); TST(totalizer);
TST(distribution); TST(distribution);
} }

15
src/test/slicing.cpp Normal file
View file

@ -0,0 +1,15 @@
#include "math/polysat/slicing.h"
namespace polysat {
class test_slicing {
};
}
void tst_slicing() {
using namespace polysat;
std::cout << "ok\n";
}