test_unknown_is_short_circuited_by_a_decisive_operand¶
Tests › tests/test_preprocessor.py
What this test is for
Why it exists
`defined(A) || <unreadable>` IS true when A is defined, and `defined(B) && <unreadable>` IS false when B is not. Poisoning the whole expression with UNKNOWN would grade down edges whose branch really is determined — the false-weakening direction, which costs traversal in `mark_reachability` and the thread BFS.
Verifies REQ-DDB-PIPE-014
Given
on = frozenset({"A"})
When
evaluate_condition("defined(A) || _POSIX_VERSION >= 1", on)evaluate_condition("defined(B) && _POSIX_VERSION >= 1", on)evaluate_condition("defined(B) || _POSIX_VERSION >= 1", on)evaluate_condition("defined(A) && _POSIX_VERSION >= 1", on)
Then
- ✓ evaluate_condition("defined(A) || _POSIX_VERSION >= 1", on) is True
- ✓ evaluate_condition("defined(B) && _POSIX_VERSION >= 1", on) is False
- ✓ evaluate_condition("defined(B) || _POSIX_VERSION >= 1", on) is None
- ✓ evaluate_condition("defined(A) && _POSIX_VERSION >= 1", on) is None
tests/test_preprocessor.py:758 · its file's page
What it checks (4)
assert evaluate_condition("defined(A) || _POSIX_VERSION >= 1", on) is Trueobservesevaluate_conditionassert evaluate_condition("defined(B) && _POSIX_VERSION >= 1", on) is Falseobservesevaluate_conditionassert evaluate_condition("defined(B) || _POSIX_VERSION >= 1", on) is Noneobservesevaluate_conditionassert evaluate_condition("defined(A) && _POSIX_VERSION >= 1", on) is Noneobservesevaluate_condition
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-PIPE-014 | catalog | unknown |
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-004 measured