test_evaluate_condition_folds_boolean_operators

Tests › tests/test_preprocessor.py

passed Passed in the packaged run.

What this test is for

Why it exists

`||` binds looser than `&&`, so `defined(A) && defined(B) || defined(C)` is `(A&&B) || C`. Splitting on `&&` first would read it as `A && (B||C)` and give the opposite answer for A undefined, C defined.

Verifies REQ-DDB-PIPE-014

Given

  1. on = frozenset({"A", "C"})
→

When

  1. evaluate_condition("defined(A) && defined(C)", on)
  2. evaluate_condition("defined(A) && defined(B)", on)
  3. evaluate_condition("defined(B) || defined(C)", on)
5 more
  1. evaluate_condition("defined(A) && defined(B) || defined(C)", on)
  2. evaluate_condition("defined(A) && (defined(B) || defined(C))", on)
  3. evaluate_condition("(defined(B) || defined(D))", on)
  4. evaluate_condition("(defined(A)) && (defined(C))", on)
  5. evaluate_condition("(defined(A)) && (defined(B))", on)
→

Then

  1. ✓ evaluate_condition("defined(A) && defined(C)", on) is True
  2. ✓ evaluate_condition("defined(A) && defined(B)", on) is False
  3. ✓ evaluate_condition("defined(B) || defined(C)", on) is True
  4. ✓ evaluate_condition("defined(A) && defined(B) || defined(C)", on) is True
  5. ✓ evaluate_condition("defined(A) && (defined(B) || defined(C))", on) is True
  6. ✓ evaluate_condition("(defined(B) || defined(D))", on) is False
  7. ✓ evaluate_condition("(defined(A)) && (defined(C))", on) is True
  8. ✓ evaluate_condition("(defined(A)) && (defined(B))", on) is False

tests/test_preprocessor.py:720 · its file's page

What it checks (8)

  1. assert evaluate_condition("defined(A) && defined(C)", on) is True observes evaluate_condition
  2. assert evaluate_condition("defined(A) && defined(B)", on) is False observes evaluate_condition
  3. assert evaluate_condition("defined(B) || defined(C)", on) is True observes evaluate_condition
  4. assert evaluate_condition("defined(A) && defined(B) || defined(C)", on) is True observes evaluate_condition
  5. assert evaluate_condition("defined(A) && (defined(B) || defined(C))", on) is True observes evaluate_condition
  6. assert evaluate_condition("(defined(B) || defined(D))", on) is False observes evaluate_condition
  7. assert evaluate_condition("(defined(A)) && (defined(C))", on) is True observes evaluate_condition
  8. assert evaluate_condition("(defined(A)) && (defined(B))", on) is False observes evaluate_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

test_evaluate_condition_folds_boolean_operators→evaluate_condition

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.

test_evaluate_condition_folds_boolean_operators · 8 checksevaluate_conditionREQ-DDB-CONFIG-004 · measured

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-PIPE-014catalogunknown
Also reaches 1 requirement

Its run touches their code; that is reach, not proof.