mirror of
https://github.com/Z3Prover/z3
synced 2026-08-04 05:03:30 +00:00
test: replace SASSERT with ENSURE, remove Windows-only guards (#10086)
Unit tests relied on `SASSERT()` which is a no-op in release builds (`DEBUG_CODE` wrapper), silently skipping all assertions outside debug mode. Several test files were also gated behind `#ifdef _WINDOWS`, making them dead code on Linux/macOS CI. ## Changes - **`SASSERT` → `ENSURE` in 20 test files (200 occurrences)**: `ENSURE` maps to `VERIFY` and always executes regardless of build type, ensuring test assertions are active in both debug and release builds. - **`src/test/diff_logic.cpp`**: Removed `#ifdef _WINDOWS` wrapping the entire file. No Windows-specific APIs were used; the guard only prevented compilation on non-Windows platforms. - **`src/test/dl_product_relation.cpp`**: Removed `#ifdef _WINDOWS` guard around `tst_dl_product_relation()`. The function body has no platform dependencies. - **`src/test/sat_local_search.cpp`**: Replaced `sscanf_s` (MSVC-specific) with portable `sscanf`; added return-value check to detect malformed input. Previously, `build_instance()` unconditionally returned `false` on non-Windows, making the SAT local search test a no-op on Linux/macOS. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
parent
b0a77d2a58
commit
c4b0fe33bc
23 changed files with 205 additions and 219 deletions
|
|
@ -61,13 +61,13 @@ bool expr_delta::delta_dfs(unsigned& n, expr* e, expr_ref& result) {
|
|||
}
|
||||
else if (is_app(e)) {
|
||||
if (m.is_bool(e)) {
|
||||
SASSERT(n >= 2);
|
||||
ENSURE(n >= 2);
|
||||
n -= 2;
|
||||
}
|
||||
return delta_dfs(n, to_app(e), result);
|
||||
}
|
||||
else if (is_quantifier(e)) {
|
||||
SASSERT(n >= 2);
|
||||
ENSURE(n >= 2);
|
||||
n -= 2;
|
||||
quantifier* q = to_quantifier(e);
|
||||
if (delta_dfs(n, q->get_expr(), result)) {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ expr* expr_rand::choose_expr(sort* s) {
|
|||
if (!m_nodes.find(s, vals)) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
SASSERT(vals);
|
||||
ENSURE(vals);
|
||||
}
|
||||
unsigned idx = m_random(vals->size());
|
||||
return (*vals)[idx].get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue