3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-28 08:58:44 +00:00

fix unit tests

This commit is contained in:
Jakob Rath 2023-08-07 17:38:00 +02:00
parent 4b4f0558b4
commit d36262d731
3 changed files with 20 additions and 14 deletions

View file

@ -1,6 +1,7 @@
#include "math/polysat/log.h" #include "math/polysat/log.h"
#include "math/polysat/solver.h" #include "math/polysat/solver.h"
#include "math/polysat/variable_elimination.h" #include "math/polysat/variable_elimination.h"
#include "smt/params/smt_params.h"
#include "ast/ast.h" #include "ast/ast.h"
#include "parsers/smt2/smt2parser.h" #include "parsers/smt2/smt2parser.h"
#include "util/util.h" #include "util/util.h"
@ -28,41 +29,41 @@ namespace {
unsigned i = k % 3; unsigned i = k % 3;
unsigned j = k % 2; unsigned j = k % 2;
if (i == 1) if (i == 1)
std::swap(a, b); swap(a, b);
else if (i == 2) else if (i == 2)
std::swap(a, c); swap(a, c);
if (j == 1) if (j == 1)
std::swap(b, c); swap(b, c);
} }
void permute_args(unsigned n, pdd& a, pdd& b, pdd& c, pdd& d) { void permute_args(unsigned n, pdd& a, pdd& b, pdd& c, pdd& d) {
SASSERT(n < 24); SASSERT(n < 24);
switch (n % 4) { switch (n % 4) {
case 1: case 1:
std::swap(a, b); swap(a, b);
break; break;
case 2: case 2:
std::swap(a, c); swap(a, c);
break; break;
case 3: case 3:
std::swap(a, d); swap(a, d);
break; break;
default: default:
break; break;
} }
switch (n % 3) { switch (n % 3) {
case 1: case 1:
std::swap(b, c); swap(b, c);
break; break;
case 2: case 2:
std::swap(b, d); swap(b, d);
break; break;
default: default:
break; break;
} }
switch (n % 2) { switch (n % 2) {
case 1: case 1:
std::swap(c, d); swap(c, d);
break; break;
default: default:
break; break;
@ -233,6 +234,7 @@ namespace polysat {
struct solver_scope { struct solver_scope {
reslimit lim; reslimit lim;
smt_params pars;
}; };
class scoped_solver : public solver_scope, public solver { class scoped_solver : public solver_scope, public solver {
@ -241,7 +243,7 @@ namespace polysat {
test_record* m_last_finished = nullptr; test_record* m_last_finished = nullptr;
public: public:
scoped_solver(std::string name): solver(lim), m_name(name) { scoped_solver(std::string name): solver(lim, pars), m_name(name) {
if (collect_test_records) if (collect_test_records)
std::cout << m_name << std::flush; std::cout << m_name << std::flush;
else { else {
@ -262,7 +264,7 @@ namespace polysat {
void set_max_conflicts(unsigned c) { void set_max_conflicts(unsigned c) {
params_ref p; params_ref p;
p.set_uint("max_conflicts", c); p.set_uint("max_conflicts", c);
updt_params(p); updt_polysat_params(p);
} }
void check() { void check() {
@ -1305,7 +1307,7 @@ namespace polysat {
expect_lemma_cnt(cfl, 1); // Eliminating "x" fails because there is no assignment for "y"; eliminating "y" works expect_lemma_cnt(cfl, 1); // Eliminating "x" fails because there is no assignment for "y"; eliminating "y" works
expect_lemma(s, cfl, s.ule(3 * z - 7 * x * z, 2)); expect_lemma(s, cfl, s.ule(3 * z - 7 * x * z, 2));
s.assign_core(y.var(), rational(2), justification::propagation(0)); s.assign_core(y.var(), rational(2), justification::propagation_by_viable(0));
conflict cfl2(s); conflict cfl2(s);
cfl2.insert(c1); cfl2.insert(c1);

View file

@ -1,5 +1,6 @@
#include "math/polysat/slicing.h" #include "math/polysat/slicing.h"
#include "math/polysat/solver.h" #include "math/polysat/solver.h"
#include "smt/params/smt_params.h"
namespace { namespace {
@ -23,11 +24,12 @@ namespace polysat {
struct solver_scope_slicing { struct solver_scope_slicing {
reslimit lim; reslimit lim;
smt_params pars;
}; };
class scoped_solver_slicing : public solver_scope_slicing, public solver { class scoped_solver_slicing : public solver_scope_slicing, public solver {
public: public:
scoped_solver_slicing(): solver(lim) {} scoped_solver_slicing(): solver(lim, pars) {}
slicing& sl() { return m_slicing; } slicing& sl() { return m_slicing; }
}; };

View file

@ -2,6 +2,7 @@
#include "math/polysat/solver.h" #include "math/polysat/solver.h"
#include "math/polysat/viable.h" #include "math/polysat/viable.h"
#include "math/polysat/univariate/univariate_solver.h" #include "math/polysat/univariate/univariate_solver.h"
#include "smt/params/smt_params.h"
namespace polysat { namespace polysat {
@ -34,11 +35,12 @@ namespace polysat {
struct solver_scopev { struct solver_scopev {
reslimit lim; reslimit lim;
smt_params pars;
}; };
class scoped_solverv : public solver_scopev, public solver { class scoped_solverv : public solver_scopev, public solver {
public: public:
scoped_solverv(): solver(lim) {} scoped_solverv(): solver(lim, pars) {}
viable& v() { return m_viable; } viable& v() { return m_viable; }
}; };