test_the_harvest_reads_both_branches_of_a_conditional_define¶
Tests › tests/test_macro_recovery.py
What this test is for
Why it exists
The parser has no preprocessor, so BOTH `#define`s are ordinary nodes to it. This is the premise of the whole change and it is asserted before anything is stored: if the walk saw one, no dedup rule downstream could recover the other.
Given
- —
When
parsed = _ast_parse_one_file(HEADER, repo / HEADER, {})tree, src = parsedmacros = {(m.name, m.line): m for m in harvest_macro_definitions(tree, src)}
Then
- ✓ parsed is not None
- ✓ macros[("PRIVATE", GATED_LINE)].expansion equals "private_##member"
- ✓ macros[("PRIVATE", ELSE_LINE)].expansion equals "member"
- ✓ macros[("PRIVATE", GATED_LINE)].params equals ("member",)
- ✓ macros[("PRIVATE", ELSE_LINE)].params equals ("member",)
- ✓ macros[("MBEDTLS_PRIVATE_ACCESS_H", 8)].expansion equals ""
- ✓ macros[("MBEDTLS_PRIVATE_ACCESS_H", 8)].params equals ()
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
clew — `main` (clew/cli.py) · 7 of 400 steps
… 70 earlier steps
… 313 later steps
tests/test_macro_recovery.py:210 · its file's page
What it checks (7)
assert parsed is not Noneobserves_ast_parse_one_fileviaparsedassert macros[("PRIVATE", GATED_LINE)].expansion == "private_##member"observesharvest_macro_definitionsviamacrosassert macros[("PRIVATE", ELSE_LINE)].expansion == "member"observesharvest_macro_definitionsviamacrosassert macros[("PRIVATE", GATED_LINE)].params == ("member",)observesharvest_macro_definitionsviamacrosassert macros[("PRIVATE", ELSE_LINE)].params == ("member",)observesharvest_macro_definitionsviamacrosassert macros[("MBEDTLS_PRIVATE_ACCESS_H", 8)].expansion == ""observesharvest_macro_definitionsviamacrosassert macros[("MBEDTLS_PRIVATE_ACCESS_H", 8)].params == ()observesharvest_macro_definitionsviamacros
Where the product reaches it
main→propose_main→propose→build_context→scan_repo→_ast_parse_one_file(flow)
Call flow
test_the_harvest_reads_both_branches_of_a_conditional_define→_ast_parse_one_file→harvest_macro_definitionsWhat 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.
Also reaches 3 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-011 measured
- REQ-DDB-PIPE-012 inferred