test_the_header_scan_reads_only_live_defines¶
Tests › tests/test_preprocessor.py
What this test is for
Why it exists
The mbedtls idiom is a header of top-level defines with the alternatives COMMENTED OUT, so skipping `//#define` and `/* #define */` is not tidiness — it is the difference between reading the shipped configuration and reading every configuration the project supports at once.
Verifies REQ-DDB-PIPE-014
Given
header = tmp_path / "config.h"header.write_text(CONFIG_HEADER, encoding="utf-8")
When
macros = macros_from_header(header)
Then
- ✓ macros contains '"FIXTURE_FEATURE_C"'
- ✓ macros contains '"FIXTURE_WIDTH=16"'
- ✓ any("DISABLED" in m for m in macros) is false
- ✓ macros contains '"FIXTURE_CONFIG_H"'
tests/test_preprocessor.py:463 · its file's page
What it checks (4)
assert '"FIXTURE_FEATURE_C"' in macrosobservesmacros_from_headerviamacrosassert '"FIXTURE_WIDTH=16"' in macros, "a trailing block comment leaked into the value"observesmacros_from_headerviamacrosassert not any("DISABLED" in m for m in macros), "a commented-out define was harvested"observesmacros_from_headerviamacrosassert '"FIXTURE_CONFIG_H"' in macros, "the include guard is a define like any other"observesmacros_from_headerviamacros
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