3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-07 00:11:55 +00:00

ensure that assertions within the unit tests are exercised in all build modes, remove special handling of SASSERT for release mode #1163

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-07-26 20:28:55 -07:00
parent 3f8b63f5a8
commit b1298d7bde
67 changed files with 1277 additions and 1285 deletions

View file

@ -70,20 +70,20 @@ static void tst2() {
g.init_var(3);
g.init_var(4);
smt::literal d;
SASSERT(g.enable_edge(g.add_edge(1, 2, rational(-1), l1)));
SASSERT(g.get_edge_weight(1, 2, w, d) && w == rational(-1));
SASSERT(!g.get_edge_weight(2, 3, w, d));
SASSERT(g.enable_edge(g.add_edge(2, 3, rational(-2), l2)));
SASSERT(g.enable_edge(g.add_edge(1, 4, rational(1), l3)));
SASSERT(g.get_edge_weight(1, 2, w, d) && w == rational(-1));
SASSERT(g.get_edge_weight(1, 4, w, d) && w == rational(1));
SASSERT(!g.get_edge_weight(1, 3, w, d));
SASSERT(g.enable_edge(g.add_edge(2, 4, rational(10), l6)));
SASSERT(g.is_feasible());
ENSURE(g.enable_edge(g.add_edge(1, 2, rational(-1), l1)));
ENSURE(g.get_edge_weight(1, 2, w, d) && w == rational(-1));
ENSURE(!g.get_edge_weight(2, 3, w, d));
ENSURE(g.enable_edge(g.add_edge(2, 3, rational(-2), l2)));
ENSURE(g.enable_edge(g.add_edge(1, 4, rational(1), l3)));
ENSURE(g.get_edge_weight(1, 2, w, d) && w == rational(-1));
ENSURE(g.get_edge_weight(1, 4, w, d) && w == rational(1));
ENSURE(!g.get_edge_weight(1, 3, w, d));
ENSURE(g.enable_edge(g.add_edge(2, 4, rational(10), l6)));
ENSURE(g.is_feasible());
g.push();
SASSERT(g.enable_edge(g.add_edge(3, 0, rational(2), l4)));
SASSERT(!g.enable_edge(g.add_edge(0, 1, rational(-1), l5)));
SASSERT(!g.is_feasible());
ENSURE(g.enable_edge(g.add_edge(3, 0, rational(2), l4)));
ENSURE(!g.enable_edge(g.add_edge(0, 1, rational(-1), l5)));
ENSURE(!g.is_feasible());
TRACE("diff_logic", g.display(tout););
struct proc {
svector<bool> found;
@ -96,22 +96,22 @@ static void tst2() {
};
proc p;
g.traverse_neg_cycle(true, p);
SASSERT(p.found[0] == false);
SASSERT(p.found[1] == true);
SASSERT(p.found[2] == true);
SASSERT(p.found[3] == false);
SASSERT(p.found[4] == true);
SASSERT(p.found[5] == true);
SASSERT(p.found[6] == false);
ENSURE(p.found[0] == false);
ENSURE(p.found[1] == true);
ENSURE(p.found[2] == true);
ENSURE(p.found[3] == false);
ENSURE(p.found[4] == true);
ENSURE(p.found[5] == true);
ENSURE(p.found[6] == false);
g.pop(1);
SASSERT(g.is_feasible());
ENSURE(g.is_feasible());
TRACE("diff_logic", g.display(tout););
}
static int add_edge(dlg& g, dl_var src, dl_var dst, int weight, unsigned lit) {
int id = g.add_edge(src, dst, rational(weight), smt::literal(lit));
bool ok = g.enable_edge(id);
SASSERT(ok);
ENSURE(ok);
return id;
}
@ -147,7 +147,7 @@ static void tst3() {
for (unsigned i = 0; i < subsumed.size(); ++i) {
std::cout << "subsumed: " << subsumed[i] << "\n";
SASSERT(e38 == subsumed[i]);
ENSURE(e38 == subsumed[i]);
tst_dl_functor tst_fn;