3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-09 16:55:47 +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

@ -27,11 +27,11 @@ static void tst_shl(unsigned src_sz, unsigned const * src, unsigned k,
if (trace)
std::cout << " for sz = " << sz << std::endl;
shl(src_sz, src, k, sz, actual_dst.c_ptr());
SASSERT(!has_one_at_first_k_bits(sz, actual_dst.c_ptr(), k));
ENSURE(!has_one_at_first_k_bits(sz, actual_dst.c_ptr(), k));
for (unsigned i = 0; i < sz; i++) {
if (trace && dst[i] != actual_dst[i])
std::cout << "UNEXPECTED RESULT at [" << i << "]: " << actual_dst[i] << ", expected: " << dst[i] << "\n";
SASSERT(dst[i] == actual_dst[i]);
ENSURE(dst[i] == actual_dst[i]);
}
if (sz == src_sz) {
unsigned nz1 = nlz(sz, src);
@ -52,7 +52,7 @@ static void tst_shl(unsigned src_sz, unsigned const * src, unsigned k,
if (trace && src[i] != new_src[i]) {
std::cout << "shr BUG, inverting shl, at bit[" << i << "], " << new_src[i] << ", expected: " << src[i] << std::endl;
}
SASSERT(src[i] == new_src[i]);
ENSURE(src[i] == new_src[i]);
}
}
}
@ -65,7 +65,7 @@ static void tst_shl(unsigned src_sz, unsigned const * src, unsigned k,
for (unsigned i = 0; i < dst_sz; i++) {
if (trace && dst[i] != actual_dst[i])
std::cout << "UNEXPECTED RESULT at [" << i << "]: " << actual_dst[i] << ", expected: " << dst[i] << "\n";
SASSERT(dst[i] == actual_dst[i]);
ENSURE(dst[i] == actual_dst[i]);
}
if (src_sz <= dst_sz) {
if (trace)
@ -74,7 +74,7 @@ static void tst_shl(unsigned src_sz, unsigned const * src, unsigned k,
for (unsigned i = 0; i < src_sz; i++) {
if (trace && src[i] != dst[i])
std::cout << "UNEXPECTED RESULT at [" << i << "]: " << src[i] << ", expected: " << dst[i] << "\n";
SASSERT(src[i] == actual_dst[i]);
ENSURE(src[i] == actual_dst[i]);
}
}
}
@ -134,7 +134,7 @@ static void tst_shr(unsigned src_sz, unsigned const * src, unsigned k,
for (unsigned i = 0; i < src_sz; i++) {
if (trace && dst[i] != actual_dst[i])
std::cout << "UNEXPECTED RESULT at [" << i << "]: " << actual_dst[i] << ", expected: " << dst[i] << "\n";
SASSERT(dst[i] == actual_dst[i]);
ENSURE(dst[i] == actual_dst[i]);
}
}
@ -172,7 +172,7 @@ static void tst_shl_rand(unsynch_mpz_manager & m, unsigned sz, unsigned k, bool
m.mul2k(max, 32);
while (!m.is_zero(_dst)) {
m.mod(_dst, max, tmp);
SASSERT(m.is_uint64(tmp) && m.get_uint64(tmp) < UINT_MAX);
ENSURE(m.is_uint64(tmp) && m.get_uint64(tmp) < UINT_MAX);
dst.push_back(static_cast<unsigned>(m.get_uint64(tmp)));
m.div(_dst, max, _dst);
}